Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
I am trying to get a distinct count of values where the sum of values is not zero
Below I have a basic distinct count:
Segment | Amount | var1 | var2 |
A | 10 | example | random1 |
A | 1 | example 2 | random 2 |
B | 0 | example 3 | random 3 |
C | 1 | example 4 | random 4 |
D | 2 | example 5 | random 5 |
D | 2 | example 6 | random 6 |
Solved! Go to Solution.
Thanks for your suggestions all but strangely none worked with my dataset. I'm not sure if it's the size of the dataset or the fact that it is running through a direct query causing the issue.
To get around it I created an additional table from the main query using a combination of the CALCULATETABLE, SUMMARIZE and FILTER functions and put a count card visual pulling data from new table.
Thanks for your suggestions all but strangely none worked with my dataset. I'm not sure if it's the size of the dataset or the fact that it is running through a direct query causing the issue.
To get around it I created an additional table from the main query using a combination of the CALCULATETABLE, SUMMARIZE and FILTER functions and put a count card visual pulling data from new table.
I have expanded the example table so that it is more in line with my dataset, apologies if it was unclear.
Thanks for the response but your formula does't seem to work for the updated table
Hi @BI-Bola ,
After my test, I can get the expected results.
If my understanding is wrong, please share the result you expect.
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks a lot. I have tried this for my case with conditional distinct count and it worked 🙂
If this resolves your solution mark it as a solution so that it will help others and don't hesitate to give kudos.
Thanks,
Pravin
Hi @BI-Bola
Heve you tried the solution which i suggested.
measure= Sumx(summerize(table,table[sagement],"Total",sum(table[Amount])),If(Total>0,1,0))
Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar
If I resolve your problem Mark it as a solution and give kudos.
Hi @BI-Bola ,
You can try the DAX below:
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Create measure
measure= Sumx(summerize(table,table[sagement],"Total",sum(table[Amount]),If(Total>0,1,0))
Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar
If I resolve your problem Mark it as a solution and give kudos.
Doesn't seem to work, spelling of functions were corrected
it's my bad.
I forgot to close bracket.
measure= Sumx(summerize(table,table[sagement],"Total",sum(table[Amount])),If(Total>0,1,0))
Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar
If I resolve your problem Mark it as a solution and give kudos.
@Anonymous
Original post updated
I am after a distinct count of the segment column values where the sum of "Amount" is not equal to zero
do you want a distinct count or row count? distinct count on segment will just count the segment?
Proud to be a Super User!
share some sample data and expected output.
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
User | Count |
---|---|
80 | |
40 | |
31 | |
27 | |
27 |