Forum Discussion
Interactive info-graphics.
- 6 years ago
Hi Anonymous ,
You should use a What if analisys. (https://docs.microsoft.com/en-us/power-bi/desktop-what-if)
This will create an auxiliary table that you can then use as a slicer and use a variable on your measures to make the calculations.
Regards,
MFelix
- 6 years ago
Hi Anonymous ,
First, Create a What IF parameter.Second, modify the DAX formula of the [Parameter Value] mearue:
Number of case = VAR x = SELECTEDVALUE('Parameter'[case number], 1) VAR y = CALCULATE( COUNT(Sheet2[Case]), ALLEXCEPT( Sheet2, Sheet2[Cost] ) ) RETURN IF( ISFILTERED(Parameter[case number]) && y=x , x )Second, Create a [total cost] measure:
total cost = CALCULATE( SUM(Sheet2[Cost]), FILTER( Sheet2, [Number of case] ) )(Result visualization)
(Original data table)
Best regards,
Lionel ChenIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous ,
First, Create a What IF parameter.
Second, modify the DAX formula of the [Parameter Value] mearue:
Number of case =
VAR x =
SELECTEDVALUE('Parameter'[case number], 1)
VAR y =
CALCULATE(
COUNT(Sheet2[Case]),
ALLEXCEPT(
Sheet2,
Sheet2[Cost]
)
)
RETURN
IF(
ISFILTERED(Parameter[case number]) && y=x ,
x
)
Second, Create a [total cost] measure:
total cost =
CALCULATE(
SUM(Sheet2[Cost]),
FILTER(
Sheet2,
[Number of case]
)
)
(Result visualization)
(Original data table)
Best regards,
Lionel Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.