Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi all,
I have the following measure which I would like to place in a calculation group so that I do not need to recreate this for each measure I want to use it.
The following measure I use to calculate an average/ index
_IndexMeasure =
VAR _Months =
CALCULATE ( DISTINCTCOUNT ( 'Date'[Month Year Long] ), REMOVEFILTERS () )
VAR _Index =
CALCULATE (
SUMX ( 'Table1', 'Table1'[Value %] ),
REMOVEFILTERS ( 'Date'[Month Year Long] )
)
RETURN
DIVIDE ( _Index, _Months )
VAR _Months =
CALCULATE ( DISTINCTCOUNT ( 'Date'[Month Year Long] ), REMOVEFILTERS () )
VAR _Index =
CALCULATE (
SUMX ( SELECTEDMEASURE() ),
REMOVEFILTERS ( 'Date'[Month Year Long] )
)
RETURN
DIVIDE ( _Index, _Months )
But this does not work, because SUMX() needs 2 parameters. But how can I make this dynamic so that I can use the exact same functionality for other columns/ tables as well?
Solved! Go to Solution.
Why do you need the SUMX? I would try it with just
CALCULATE(SELECTEDMEASURE(), ...
Pat
Why do you need the SUMX? I would try it with just
CALCULATE(SELECTEDMEASURE(), ...
Pat
Thank you, this works as well.
User | Count |
---|---|
84 | |
80 | |
69 | |
46 | |
46 |
User | Count |
---|---|
106 | |
50 | |
47 | |
40 | |
39 |