Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I have to calculate measure DIFF = [PLAN]-[SUMM] over only [Type] column for every value
and summ only values >0
[PLAN] = SUM(tab[plan]) [SUMM] = SUM(tab[fact])
I tried use SUMMARIZECOLUMNS, but I got error "SummarizeColumns() and AddMissingItems() may not be used in this context"
DIFF = VAR tab = SUMMARIZECOLUMNS(crm[Type];"diff";[PLAN]-[SUMM])) RETURN SUMX(tab;[diff])
and cant understand how to add checking
[PLAN]-[SUMM] > 0
in this calculation
Help please
Solved! Go to Solution.
Without having your source dataset to work with, I can only attempt a theoretical solution... have a try and see if this works:
Create a measure called "DIFF (PLAN-SUMM)" :
=VAR isInRow = HASONEVALUE( tab[Type] )
RETURN SUMX(
VALUES( tab[Type] )
, CALCULATE(
VAR thePlan = SUM(tab[PLAN])
VAR theSumm = SUM(tab[SUMM])
VAR DIFF = thePlan - theSumm
RETURN
IF ( DIFF >= 0, DIFF
, IF( isInRow, DIFF
, 0 )
)
)
)
This measure should work in both the grand total cell and in each row.
When it's in "row mode", all kinds of DIFF's will be displayed, but
when it's in grand total mode, only DIFF>=0 will be included.
Without having your source dataset to work with, I can only attempt a theoretical solution... have a try and see if this works:
Create a measure called "DIFF (PLAN-SUMM)" :
=VAR isInRow = HASONEVALUE( tab[Type] )
RETURN SUMX(
VALUES( tab[Type] )
, CALCULATE(
VAR thePlan = SUM(tab[PLAN])
VAR theSumm = SUM(tab[SUMM])
VAR DIFF = thePlan - theSumm
RETURN
IF ( DIFF >= 0, DIFF
, IF( isInRow, DIFF
, 0 )
)
)
)
This measure should work in both the grand total cell and in each row.
When it's in "row mode", all kinds of DIFF's will be displayed, but
when it's in grand total mode, only DIFF>=0 will be included.
You're welcome!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
97 | |
85 | |
67 | |
59 |
User | Count |
---|---|
150 | |
120 | |
100 | |
87 | |
68 |