Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hello.
Unsure what the issue is here - I created a measure to find the difference between two sets of values ('A' and 'B' for simplicity):
Difference =
Solved! Go to Solution.
Hi @TM_ ,
You can use the bellow DAX measure to achieve your goal:
CategoryOutperformance =
CALCULATE(
DISTINCTCOUNT('Test2'[Category]),
FILTER(
ADDCOLUMNS(
VALUES('Test2'[Category]),
"Difference",
VAR A = CALCULATE(SUM('Test2'[Value]), 'Test2'[Subcategory] = "A")
VAR B = CALCULATE(SUM('Test2'[Value]), 'Test2'[Subcategory] = "B")
RETURN IF(ISBLANK(A), BLANK(), A - B)
),
[Difference] < 0
)
)
Your output should look like this:
Hi @TM_ ,
You can use the bellow DAX measure to achieve your goal:
CategoryOutperformance =
CALCULATE(
DISTINCTCOUNT('Test2'[Category]),
FILTER(
ADDCOLUMNS(
VALUES('Test2'[Category]),
"Difference",
VAR A = CALCULATE(SUM('Test2'[Value]), 'Test2'[Subcategory] = "A")
VAR B = CALCULATE(SUM('Test2'[Value]), 'Test2'[Subcategory] = "B")
RETURN IF(ISBLANK(A), BLANK(), A - B)
),
[Difference] < 0
)
)
Your output should look like this:
Hi @TM_ - It’s possible that there’s an issue with the current context or filter. Let’s try to modify your CategoryOutperformance measure to ensure it’s correctly filtering and counting the distinct categories.
CategoryOutperformance =
CALCULATE(
DISTINCTCOUNT('Test'[Category]),
FILTER(
'Test',
NOT(ISBLANK([Difference])) && [Difference] < 0
)
)
I hope it works, If you’re still having trouble, feel free to share more details or a sample of your data.
Proud to be a Super User! | |
Thank you for your reply! Unfortunately, this hasn't worked.
More detail below, data set:
I used this formula in full to calculate the Difference where there was a value in Subcategory A:
Hi @TM_ ,
You can create two measures as below to get it, please find the details in the attachment.
Measure =
VAR _diff = [Difference]
RETURN
CALCULATE ( DISTINCTCOUNT ( 'Test2'[Category] ), FILTER ( 'Test2', _diff < 0 ) )CategoryOutperformance = SUMX ( VALUES ( Test2[Category] ), [Measure] )
Best Regards
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 46 | |
| 43 | |
| 39 | |
| 20 | |
| 15 |
| User | Count |
|---|---|
| 68 | |
| 68 | |
| 31 | |
| 27 | |
| 24 |