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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

NOT ABLE TO USE SWITCH OVER CATEGORICAL STRING VALUE .

HI Guys 

 

I have preapred a measure to calculate rolling last 30 days average 

Averageoflast30dayspeakdayoffpeakhour =
VAR tday= LASTDATE('KPI TABLE'[DATE])
VAR tday_2 = tday-1
return
CALCULATE(AVERAGE('KPI TABLE'[COMPLETED_ORD_COUNT]),ALLEXCEPT('KPI TABLE','KPI TABLE'[BUSINESS_SERVICE],'KPI TABLE'[DIMENSION],'KPI TABLE'[DATE]),DATESINPERIOD('KPI TABLE'[DATE],tday_2,-30,DAY))
 
I have two column in my table 1. measuring method  2. comparsion period 
 
currently the measure that i  have prepared so far is for only one scenario like measuring method = Average and comparsion period = last 30 days 
 
i have to use same measure depending on the  various combination of above mentioned two columns 
 
 
I want measure something like 
 
case when measuring_method= "average" and comparsion_period= last 30 days then calculation1
case when measuring_method= "maximum" and comparsion_period= last 30 days then calculation2
 
PLease help me !!!!!!
1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi  @Anonymous 

You just drag measuring method  and comparsion period field into a visual, then create a measure as this and drag it into visual too:

Measure =
IF (
    SELECTEDVALUE ( 'Table1'[measuring_method] ) = "average"
        && SELECTEDVALUE ( 'Table1'[comparsion_period] ) = "last 30 days",
    [calculation1],
    IF (
        SELECTEDVALUE ( 'Table1'[measuring_method] ) = "maximum"
            && SELECTEDVALUE ( 'Table1'[comparsion_period] ) = "last 30 days",
        [calculation2]
    )
)

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-lili6-msft
Community Support
Community Support

hi  @Anonymous 

You just drag measuring method  and comparsion period field into a visual, then create a measure as this and drag it into visual too:

Measure =
IF (
    SELECTEDVALUE ( 'Table1'[measuring_method] ) = "average"
        && SELECTEDVALUE ( 'Table1'[comparsion_period] ) = "last 30 days",
    [calculation1],
    IF (
        SELECTEDVALUE ( 'Table1'[measuring_method] ) = "maximum"
            && SELECTEDVALUE ( 'Table1'[comparsion_period] ) = "last 30 days",
        [calculation2]
    )
)

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thanks I will let you know soon 

amitchandak
Super User
Super User
Anonymous
Not applicable

Thanks I will check and will let you know 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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