Forum Discussion
Anonymous
4 years agoNot applicable
Measure or calculation with user input (slicer or filter)
dear PBI gurus am struggling to find the easier way to create a calculation / measure with a dynamic input from user. my starting table is as follows item item description FY Mo...
- 3 years ago
Hi Anonymous ,
Sorry for the late reply, I modify my sample to contain more items.
Then modify the formula like this:
Ordered = VAR _T = SUMMARIZE ( 'Table', 'Table'[Item], "Ordered", MAXX ( FILTER ( ALL ( 'Table' ), 'Table'[Item] = MAX ( 'Table'[Item] ) && 'Table'[dimension] = "Ordered" ), 'Table'[Quantity] ) ) RETURN SUMX ( _T, [Ordered] )Fcast M-* = VAR _T = SUMMARIZE ( 'Table', 'Table'[Item], "Fcast M-", MAXX ( FILTER ( 'Table', 'Table'[dimension] = SELECTEDVALUE ( 'Table'[dimension] ) ), 'Table'[Quantity] ) ) RETURN SUMX ( _T, [Fcast M-] )Formula result = VAR _T = SUMMARIZE ( 'Table', 'Table'[Item], "Formula resut", ABS ( [Ordered] - [Fcast M-*] ) / ( ABS ( [Ordered] ) + ABS ( [Fcast M-*] ) ) ) RETURN SUMX ( _T, [Formula resut] )Get the correct result:
I attach my sample below for your reference.
Best Regards,
Community Support Team _ kalyjIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-yanjiang-msft
Community Support
3 years agoHi Anonymous ,
Sorry for the late reply, I modify my sample to contain more items.
Then modify the formula like this:
Ordered =
VAR _T =
SUMMARIZE (
'Table',
'Table'[Item],
"Ordered",
MAXX (
FILTER (
ALL ( 'Table' ),
'Table'[Item] = MAX ( 'Table'[Item] )
&& 'Table'[dimension] = "Ordered"
),
'Table'[Quantity]
)
)
RETURN
SUMX ( _T, [Ordered] )
Fcast M-* =
VAR _T =
SUMMARIZE (
'Table',
'Table'[Item],
"Fcast M-",
MAXX (
FILTER ( 'Table', 'Table'[dimension] = SELECTEDVALUE ( 'Table'[dimension] ) ),
'Table'[Quantity]
)
)
RETURN
SUMX ( _T, [Fcast M-] )
Formula result =
VAR _T =
SUMMARIZE (
'Table',
'Table'[Item],
"Formula resut",
ABS ( [Ordered] - [Fcast M-*] )
/ ( ABS ( [Ordered] ) + ABS ( [Fcast M-*] ) )
)
RETURN
SUMX ( _T, [Formula resut] )
Get the correct result:
I attach my sample below for your reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
3 years agoNot applicable
it does work 🙂
thanks