Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Anonymous
Not applicable

Compile MeasureName by name parts and use this dynamicaly measure(name) for calculation

I have en existing measure called [O_VOL_ACT] and from this measure I derived several other measures like previous year and many others (Time Intelligent)..:
[O_VOL_ACT]

[0_VOL_ACT_PYTD]       = Previous Year To Date

[O_VOL_ACT_PY]           = Previous Year

[O_VOL_ACT_PY_DEV]   = Deviation between Previous- Actual Year

[O_VOL_ACT_PY_DOW] = Previous Year Day of Week

[O_VOL_ACT_YTD]         = Actual Year To Date

......

ahau_1-1644496977294.png

 

 



Now, what I try to archiv is, that I can compile the measurename by doint something like concatenate the base measure [O_VOL_ACT] with any suffix of the derived measures like _PY.

 

As a Result I want to get something like [O_VOL_ACT_PY] which I could use for example in a matrix.

ahau_0-1644496967311.png

 

Based on outside criteria (IF/ELSE) suffix _PY or _PY_DOW must come to action.

Of course, concatenate doesn't work! Any other ideas how to solve this issue ?

 

Regards

Alex


 

 

 

 

1 ACCEPTED SOLUTION

You can achieve that with calculated groups.
I would probably do calculated groups to select 2nd measure to compare with actual and then use visual Column Chart with Relative Variance

MargaritaG_0-1644508482457.png
So in this proposed solution you have actual added in visual and then another measure that changes value based on users selection.

 

View solution in original post

7 REPLIES 7
v-angzheng-msft
Community Support
Community Support

Hi, @Anonymous 

 

The requirement is to be able to switch the previous time selection between "previous year" and "previous year day of week". 
At the end the user should be able to tick a switch and see eighter the upper- or lower variant of comparision.

Based on what I got above, the calculation group would be a good choice.

e.g.

vangzhengmsft_2-1644977953322.png

Refer:

Introducing Calculation Groups


You can also use the Switch function with slicers
e.g.

Switch(
True(),
SelectedValue="PY",[O_VOL_ACT_PY],
SelectedValue="PYTD",[0_VOL_ACT_PYTD]
)

 

 

Best Regards,
Community Support Team _ Zeon Zheng


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

I already solved my issue. But your solution with the "Switch" and "SelectedValue" is great. Will add that to my list of (best) code snippets :-).
Thanks

tamerj1
Super User
Super User

Hi @Anonymous 
Whwn you say "Based on outside criteria (IF/ELSE) suffix _PY or _PY_DOW must come to action." what do you mean by "outside"?

MargaritaG
Resolver I
Resolver I

Hey, 

A bit unclear of the reason for such measure but perhaps Calculated Groups could work 
e.g. final solution would give user a filter to choose what you they want to see PYTD, PY, etc. and depending on that you would give result 
Calculated groups could have two measures, one to show text: using SWITCH, if SELECTEDMEASURE = PY then "PY" and etc.
and another to show correct value.
https://community.powerbi.com/t5/Desktop/using-calculation-item-in-another-calculation-items-Time/m-...

https://community.powerbi.com/t5/Desktop/Extract-name-calculation-item-from-calculation-group/m-p/16...

Anonymous
Not applicable

The requirement is to be able to switch the previous time selection between "previous year" and "previous year day of week". 
At the end the user should be able to tick a switch and see eighter the upper- or lower variant of comparision.

ahau_0-1644500091238.png

 

Calc-Group wont work.

You can achieve that with calculated groups.
I would probably do calculated groups to select 2nd measure to compare with actual and then use visual Column Chart with Relative Variance

MargaritaG_0-1644508482457.png
So in this proposed solution you have actual added in visual and then another measure that changes value based on users selection.

 

Anonymous
Not applicable

I could solve my problem with Calculation Groups, so you where right 😉 !!
Thanks for the hint.

I created an overview pic which more or less should explain my created solution.

 

ahau_0-1645453645051.png

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors