564 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owls only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
How to write queries in DAX to interrogate SSAS tabular models Part eight of an eight-part series of blogs |
---|
As well as creating measures to aggregate data in tabular models using DAX, you can also write queries to extract data - this blog shows you how!
This blog is part of our online SSAS Tabular tutorial; we also offer lots of other Analysis Services training resources. |
To wrap up this section, I thought I'd show a couple of other potentially useful DAX functions.
It can be useful when testing DAX to be able to show single values, using the ROW function. The syntax is:
The ROW function is similar to a SELECT statement in SQL run without a FROM clause.
Here's an example query, listing out the current user name, time and number of products:
-- show the current user and time
EVALUATE
ROW (
"Current user",
USERNAME (),
"Current time",
FORMAT ( NOW (), "HH:mm:ss" ),
"Number of products",
COUNT ( Product[ProductId] )
)
This would give these results:
This query would display these 3 bits of information.
The CONTAINS function has the following syntax, and returns TRUE or FALSE:
Here's an example of the function, showing whether there's a product called Wol with a list price of £3.95 (there is):
-- look for product with specific
-- name and price
EVALUATE
ROW (
"Does WOL exist?",
CONTAINS (
Product,
Product[ProductName],
"Wol",
Product[FullPrice],
3.95
)
)
Here are the unexciting results from running this query:
A product called WOL costing £3.95 does exist in the Product table.
And on that slightly anti-climactic note, I've finished showing the DAX query syntax that I wanted to cover!
Some other pages relevant to the above blogs include:
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2023. All Rights Reserved.