Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi there,
I have the following dataset...
Sample APR is a calculated column which contains randomly generated numbers.
APR Group groups these. So basically 5.X = 5, 6.X = 6, etc etc.
I want to create a third calculated columns which counts the number of distinct values in the Sample APR column, desired output like the following....
I naturally tried to use DISTINCTCOUNT, with the following DAX:
Test = CALCULATE(DISTINCTCOUNT(Table1[Sample APR]),ALL(Table1), Table1[APR Group] = EARLIER(Table1[APR Group]))
Thanks @tex628
That appears to be grouping the APR Group column rather than the Sample APR one though. Been trying variations of your solution but still no luck unfortunately.
My apologies, i didnt read the initial post well enough!
Column = CALCULATE(COUNTROWS(Table1) , ALL(Table1) , Table1[Sample APR] = EARLIER(Table1[Sample APR]) , Table1[APR Group] = EARLIER(Table1[APR Group]))
Hope it works!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
74 | |
73 | |
56 | |
38 | |
31 |
User | Count |
---|---|
83 | |
64 | |
63 | |
49 | |
45 |