Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
I have a project table in my data model, with all 10 metrics (calculated columns) are calculated using DAX. For each metric, there are three different values: 1 (means good), 2 (means warning), and 3 (means bad). Let's say project A has 3 good metric, 3 warning metric, and 4 bad metric. I want to create calculated column for each good, warning, and bad category such that the result will be showing:
Right now my calculate column for Good category is as follow:
Good = CALCULATE(COUNT(Project[Metric1], Project[Metric1] = 1) + CALCULATE(COUNT(Project[Metric2], Project[Metric2] = 1) + ... + CALCULATE(COUNT(Project[Metric10], Project[Metric10] = 1), and so on.
Is there a more efficent way to write the above DAX expression?
Solved! Go to Solution.
Hi @Anonymous
Another way could be
Good = VAR Temp = { Project[Metric 1], Project[Metric 2], Project[Metric 3], Project[Metric 4], Project[Metric 5], Project[Metric 6], Project[Metric 7], Project[Metric 8], Project[Metric 9], Project[Metric 10] } RETURN COUNTROWS ( FILTER ( Temp, [Value] = 1 ) )
@Anonymous
For Bad and Warning... you will just have to change single Value
Warning = VAR Temp = { Project[Metric 1], Project[Metric 2], Project[Metric 3], Project[Metric 4], Project[Metric 5], Project[Metric 6], Project[Metric 7], Project[Metric 8], Project[Metric 9], Project[Metric 10] } RETURN COUNTROWS ( FILTER ( Temp, [Value] = 2 ) )
Hi @Anonymous
Another way could be
Good = VAR Temp = { Project[Metric 1], Project[Metric 2], Project[Metric 3], Project[Metric 4], Project[Metric 5], Project[Metric 6], Project[Metric 7], Project[Metric 8], Project[Metric 9], Project[Metric 10] } RETURN COUNTROWS ( FILTER ( Temp, [Value] = 1 ) )
@Anonymous
For Bad and Warning... you will just have to change single Value
Warning = VAR Temp = { Project[Metric 1], Project[Metric 2], Project[Metric 3], Project[Metric 4], Project[Metric 5], Project[Metric 6], Project[Metric 7], Project[Metric 8], Project[Metric 9], Project[Metric 10] } RETURN COUNTROWS ( FILTER ( Temp, [Value] = 2 ) )
User | Count |
---|---|
78 | |
75 | |
62 | |
60 | |
46 |
User | Count |
---|---|
109 | |
95 | |
86 | |
79 | |
61 |