Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Anonymous
Not applicable

Dax formula returning different values from SQL query

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!

1 ACCEPTED SOLUTION
amitchandak
Super User
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"
))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
PhilipTreacy
Super User
Super User

Hi @Anonymous 

Your DAX works fine with my sample data.

Can you provide your data, can't test properly without it.

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


amitchandak
Super User
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"
))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

This worked perfectly, thank you!

Helpful resources

Announcements
Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.