Is it possible to use If statement to select a measure?

Hello @lpretorius,

Thank You for posting your PBIX file alongwith the description of the results that you’re trying to achieve.

Here’re the simple formulas you’ll be required to write to achieve this results -

Switch Measure - Harsh = 
SWITCH( TRUE() ,
    SELECTEDVALUE( Dates[Year] ) = "2021" , [Total Sales] , 
    [Total Sales AVG YTD] )




Switch Measure - Harsh - Totals = 
SUMX(
    SUMMARIZE(
        TransactionList , 
        Dates[Year] , 
        ProductList[Type] , 
        "@Totals" , 
        [Switch Measure - Harsh] ) , 
    [@Totals]
)

First formula is written to achieve the results at a row level and the second formula is written to achieve the correct results of the grand totals as well.

I’m attaching the PBIX file for the reference so that you can go through it as well as providing few of the links videos based on the concepts applied in it to achieve this results.

Hoping you find this useful and meets your requirements that you’ve been looking for. :slightly_smiling_face:

Note To view the below post of “Fix Incorrect Totals” please click onto the link and not onto the “expand/collapse” button.

Thanks and Warm Regards,
Harsh

OnePageTest - Harsh.pbix (323.8 KB)