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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Dynamic measure by changing parameter slicer

Hi friends,

how can i change measure through slicer fields from parameter, i tried the normal way using switch() but it doesnt work

 

parameter slicer

Supasit_0-1705984005450.png

 

card with switch() measure

Supasit_1-1705984057800.png

 

error details

Supasit_2-1705984087215.png

 

 

5 REPLIES 5
DataInsights
Super User
Super User

@Anonymous,

 

Try this measure:

 

 

Switch Measure =
VAR vSelectedParameter =
    SELECTCOLUMNS (
        SUMMARIZE ( 'Parameter', 'Parameter'[Parameter], 'Parameter'[Parameter Fields] ),
        "Parameter", 'Parameter'[Parameter]
    )
VAR vResult =
    SWITCH (
        vSelectedParameter,
        "Aging GR>1-90 days", 1,
        "Aging GR>91 - 180 days", 2
    )
RETURN
    vResult

 





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

Proud to be a Super User!




Anonymous
Not applicable

@DataInsights it work! but just a little more, i put this measure to y axis in combo visual and if user doesnt select any slicer it will error, could you let the measure just blank or something not make visual broke?

selected one

Supasit_0-1706064894552.png

 

if not select anyone on slicer

Supasit_1-1706064962830.png

 

 

@Anonymous,

 

I would need to see your model or sample data. You can share a link to OneDrive, etc. One idea is to add an ELSE argument to the measure in case of no user selection:

 

Switch Measure =
VAR vSelectedParameter =
    SELECTCOLUMNS (
        SUMMARIZE ( 'Parameter', 'Parameter'[Parameter], 'Parameter'[Parameter Fields] ),
        "Parameter", 'Parameter'[Parameter]
    )
VAR vResult =
    SWITCH (
        vSelectedParameter,
        "Aging GR>1-90 days", 1,
        "Aging GR>91-180 days", 2,
        "put ELSE argument here"
    )
RETURN
    vResult

 





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

Proud to be a Super User!




I had to add a space to each side of the hyphen between 91 and 180 due to the community requirement below:

 

DataInsights_0-1706015844314.png

 

@Natalie_iTalent do you know why this error occurred?





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

Proud to be a Super User!




Hello @DataInsights,

Thank you for bringing this to my attention.  It has been resolved and you shouldn't have any other issues.

 

Best,

Natalie H.

Community Manager 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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