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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

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
Anonymous
Not applicable

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
Community Champion
Community Champion

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"?

Anonymous
Not applicable

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.

Anonymous
Not applicable

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
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.