Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi, I'm looking for some help with a DAX formula that would count the occurrences of a distinct value A for distinct values within a table. Regards Eamon
Value A | Required Dax formula to return the following values | ||
Distinct Values | Yes/No | Number of occurances of yes for each distinct value | |
5 | Yes | 1 | |
4 | Yes | 1 | |
4 | No | 1 | |
3 | Yes | 2 | |
3 | Yes | 2 | |
1 | Yes | 2 | |
1 | Yes | 2 | |
1 | No | 2 |
Solved! Go to Solution.
Hi @EamonC
You need a DAX Calculated column?
Column =
COUNTROWS(FILTER('Table','Table'[Distinct Values]=EARLIER('Table'[Distinct Values])&&'Table'[Yes/No]="Yes"))
Hey there,
I have the exact same problem, BUT I need the formula to create it as a measure instead of calculated column.
Since the EARLIER function as she is applied here is only working for calculated columns and not for measures, I tried following this blog post to translate the formula from the calculated column to a measure formula. Unfortunately without success.
This is my current state:
measure = CALCULATE(
COUNTROWS('Table'),
FILTER(ALL ('Table'), COUNTROWS(FILTER('Table', EARLIER('Table'[Distinct Values])='Table'[Distinct Values]&&'Table'[Yes/No]="Yes")
)
)
)
Column = CALCULATE(COUNTROWS('fact'),'fact'[Yes/No]="Yes")
Hi @EamonC
You need a DAX Calculated column?
Column =
COUNTROWS(FILTER('Table','Table'[Distinct Values]=EARLIER('Table'[Distinct Values])&&'Table'[Yes/No]="Yes"))
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
24 | |
13 | |
12 | |
11 | |
8 |
User | Count |
---|---|
42 | |
25 | |
14 | |
14 | |
12 |