Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I am trying to create a measure that counts the number of records that meet certain criteria, my SQL query returns the correct value but when I tried to convert that into DAX logic it seems to be counting all records and ignoring the filters I've included.
SQL Query:
Select Count(AUM_SITE_ID)
From Collector.Collector.GEOHAZARDS_AUM_SITE_INVENTORY Inventory
Where Status = 'A' and INSPECTION_DUE = 0
Result from this query is 3.
DAX code:
AUM Inspection Due = CALCULATE(
COUNT('AUM'[AUM_SITE_ID]),
'AUM'[INSPECTION_DUE] = 0,
'AUM'[STATUS] = "A"
)
Result from this code is 1968.
Thanks for the help!
Solved! Go to Solution.
@Anonymous , need some sample data to test.
Try this measure
AUM Inspection Due = CALCULATE(
COUNT('AUM'[AUM_SITE_ID]),
filter('AUM', not(isblank('AUM'[INSPECTION_DUE])) && 'AUM'[INSPECTION_DUE] = 0 &&
'AUM'[STATUS] = "A"
))
Hi @Anonymous
Your DAX works fine with my sample data.
Can you provide your data, can't test properly without it.
Regards
Phil
Proud to be a Super User!
@Anonymous , need some sample data to test.
Try this measure
AUM Inspection Due = CALCULATE(
COUNT('AUM'[AUM_SITE_ID]),
filter('AUM', not(isblank('AUM'[INSPECTION_DUE])) && 'AUM'[INSPECTION_DUE] = 0 &&
'AUM'[STATUS] = "A"
))
This worked perfectly, thank you!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |