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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
RoshanK
Helper II
Helper II

Smart way to switch measures (Value/Volume) for more than 10 columns

Hi, 

 

My table looks like this (plus other volume related columns):

 

RoshanK_0-1706706200496.png

I'm aiming to have all columns switch to "Value" when a user selects it.

While one apparent solution is to create a field parameter, such as "Volume/Value Period," for each column, doing so for around 10+ columns seems not optimal.

 

Is there a more efficient approach you would recommend?

 

Thanks in advance!

1 ACCEPTED SOLUTION
123abc
Community Champion
Community Champion

Power BI:

  1. Create Parameter: Go to the Modeling tab and create a new parameter named "Measure Type" with two options: "Value" and "Volume".

  2. Create Calculated Column or Measure: Use DAX to create calculated columns or measures that dynamically switch between "Value" and "Volume" based on the parameter selection. For example:

Switch(
SELECTEDVALUE('Parameter'[Measure Type]),
"Value", [Value Column],
"Volume", [Volume Column]
)

 

  1. Replace [Value Column] and [Volume Column] with the appropriate column names in your data model.

  2. Use Calculated Fields: Use the calculated columns or measures in your visualizations instead of the original columns. They will automatically adjust based on the selected measure type.

By following this approach, you can efficiently handle switching between "Value" and "Volume" for multiple columns without creating separate parameters for each column.

 
 
 
 

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

 

In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.

View solution in original post

1 REPLY 1
123abc
Community Champion
Community Champion

Power BI:

  1. Create Parameter: Go to the Modeling tab and create a new parameter named "Measure Type" with two options: "Value" and "Volume".

  2. Create Calculated Column or Measure: Use DAX to create calculated columns or measures that dynamically switch between "Value" and "Volume" based on the parameter selection. For example:

Switch(
SELECTEDVALUE('Parameter'[Measure Type]),
"Value", [Value Column],
"Volume", [Volume Column]
)

 

  1. Replace [Value Column] and [Volume Column] with the appropriate column names in your data model.

  2. Use Calculated Fields: Use the calculated columns or measures in your visualizations instead of the original columns. They will automatically adjust based on the selected measure type.

By following this approach, you can efficiently handle switching between "Value" and "Volume" for multiple columns without creating separate parameters for each column.

 
 
 
 

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

 

In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.