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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
EOW
Frequent Visitor

How to use a calculation group as a column switcher for multiple column groups?

I've got a report tracking yields at different steps in production, formatted in the following manner:

 

LotProductFinish FlagStp1 YieldStp1 Target StaticStp1 Target LiveStp1 Target FileStp2 YieldStp2 Target StaticStp2 Target LiveStp2 Target File
A101W1Y98%96%95%95%95%92%90%92%
A102W1Y97%96%95%95%91%92%90%92%
A103W2Y90%89%87%88%82%84%82%83%
A104W2N87%89%87%88%80%84%82%83%

 

I want to slice between Static, Live and File Targets in my measures, Is there a way to leverage a calulcation group and simplify the measures I've written. I've put the target set I want to use in a table called 'Target Use'.

 

 

 

Stp1 Target = 
var FilterRows = FILTER('Data', 'Data'[Finish Flag] = "Y")
var TargUse = SELECTEDVALUE('Target Use'[TargetToUse])

return
SWITCH(TRUE()
, TargUse = "Static Targets"	, AVERAGEX(FilterRows, Data[Stp1 Target Static])
, TargUse = "Live Targets"		, AVERAGEX(FilterRows, Data[Stp1 Target Live])
, TargUse = "File Targets"		, AVERAGEX(FilterRows, Data[Stp1 Target File])
, AVERAGEX(FilterRows, Data[Stp1 Target Static])
)



Stp2 Target = 
var FilterRows = FILTER('Data', 'Data'[Finish Flag] = "Y")
var TargUse = SELECTEDVALUE('Target Use'[TargetToUse])

return
SWITCH(TRUE()
, TargUse = "Static Targets"	, AVERAGEX(FilterRows, Data[Stp2 Target Static])
, TargUse = "Live Targets"		, AVERAGEX(FilterRows, Data[Stp2 Target Live])
, TargUse = "File Targets"		, AVERAGEX(FilterRows, Data[Stp2 Target File])
, AVERAGEX(FilterRows, Data[Stp2 Target Static])
)

 

 

 

Is there a way to use calculation groups to generalise the measures?

1 REPLY 1
LYPowerBI
Frequent Visitor

unpivot the target columns may help you. 

LYPowerBI_0-1739986087317.png

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.