Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi there,
I need to write a DAX in my report which will DistinctCount DocNo only for the records where Grouped value (Amount) is not zero. See the following scenario.
MyTables has several records and DistictCount will be 4 (which is not a desired result).
MyGroupTable (group by DocNo) has 4 records and DistictCount will only count records where amount is not zero, so result will be 2.
Any help will be highly appreciated.
Let me know for more details.
Solved! Go to Solution.
I was not sure whether you wanted a calculated table or a calculated measure.
There are more than a few ways in writing measures. However, without knowing the data model, all of them might be suitable for your model, or perhaps only one of them might be suitable.
https://www.dropbox.com/s/75rgey6rqntyt7k/mughalia.pbix?dl=0
Group Table =
SUMMARIZECOLUMNS (
'Table'[DocNo],
FILTER ( VALUES ( 'Table'[DocNo] ), CALCULATE ( SUM ( 'Table'[Amount] ) <> 0 ) ),
"@Amount", SUM ( 'Table'[Amount] )
)
https://www.dropbox.com/s/75rgey6rqntyt7k/mughalia.pbix?dl=0
Hi @Jihwan_Kim
Thank you for your reply.
I guess we are almost there. The DAX is returning two rows and two columns. The DAX should return only 2 in this instance, because there are only two records with non-zero amount.
Could you tweak the DAX and advise please?
Thank you
I was not sure whether you wanted a calculated table or a calculated measure.
There are more than a few ways in writing measures. However, without knowing the data model, all of them might be suitable for your model, or perhaps only one of them might be suitable.
https://www.dropbox.com/s/75rgey6rqntyt7k/mughalia.pbix?dl=0
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 97 | |
| 71 | |
| 50 | |
| 47 | |
| 44 |