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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply

Measure that would show Multiple Values based on Slicer Selection

Hello, 

I needed help to display both fields with different values within a Measure. Here's the example I created with the same situation. 

EvanGetsItDone_0-1686744957526.png


For this scenario, I don't know how am I able to display the values if "Both Magnitude and Period" is selected on the slicer. 
I added the expected result on the screenshot (the table below)

If you have a solution with different approach and logic, feel free to share. 🙂

Let me know if you need more details. 

Thanks!


1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @EvanGetsItDone ,

 

You cannot use a measure and return two measures out of it. What can be done is you add both Magnitude and Period measures to a table but these measures should have a condition in it that returns blank depending on the slicer selection. The measure will only return blank and not hide its column. As a workaround, you can create a separate table (import/enter data/calc) that will hold the measure names and its groupings and you can create a measure using the measure name column from that table. Example calc table

 

MeasureTable = 
DATATABLE (
    "Measure Group", STRING,
    "Measure Name", STRING,
    {
        { "Both Magnitude and Period Values", "Magnitude" },
        { "Both Magnitude and Period Values", "Period" },
        { "Magnitude Only", "Magnitude" },
        { "Period Only", "Period" }
    }
)

 

danextian_3-1686746931483.png

 

the measure

 

FieldValue = 
SWITCH (
    SELECTEDVALUE ( MeasureTable[Measure Name] ),
    "Magnitude", 40050,
    "Period", 13479122.76
)

 

danextian_0-1686746880458.png

danextian_1-1686746895714.png

danextian_2-1686746906662.png

 

Please see attached sample pbix





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

3 REPLIES 3
danextian
Super User
Super User

Hi @EvanGetsItDone ,

 

You cannot use a measure and return two measures out of it. What can be done is you add both Magnitude and Period measures to a table but these measures should have a condition in it that returns blank depending on the slicer selection. The measure will only return blank and not hide its column. As a workaround, you can create a separate table (import/enter data/calc) that will hold the measure names and its groupings and you can create a measure using the measure name column from that table. Example calc table

 

MeasureTable = 
DATATABLE (
    "Measure Group", STRING,
    "Measure Name", STRING,
    {
        { "Both Magnitude and Period Values", "Magnitude" },
        { "Both Magnitude and Period Values", "Period" },
        { "Magnitude Only", "Magnitude" },
        { "Period Only", "Period" }
    }
)

 

danextian_3-1686746931483.png

 

the measure

 

FieldValue = 
SWITCH (
    SELECTEDVALUE ( MeasureTable[Measure Name] ),
    "Magnitude", 40050,
    "Period", 13479122.76
)

 

danextian_0-1686746880458.png

danextian_1-1686746895714.png

danextian_2-1686746906662.png

 

Please see attached sample pbix





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hey,

Thanks for your response, this is a great logic and approach. However I don't think this works if the I use a measure or aggregate (in this case i SUM() the values) on the Switch (FieldValue measure). The grouping seems to only work if the else statement is String like what you did.

EvanGetsItDone_1-1686753326804.png

 



My Bad, I was not able to put the Measure Group on the Column field the reason it was just showing blank. I will accept this as solution as it helped me solved this issue. Thank you!

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.