Forum Discussion

nesrinehal20's avatar
nesrinehal20
Frequent Visitor
1 year ago

Dynamic measure in PowerBI

Depending on the selected year I want to display comparison between CA 2023, CA 2024, budget 2024. 

If I select other year, I want the measure names to change.

I have calculated measures: NS_N = SUM('Table'\[TOT\]), NS_N-1 = CALCULATE(\[NS_N\],SAMEPERIODLASTYEAR(Dim_Calendar\[Date\]))

I want N=selected value who ?

 

2 Replies

  • Shivu-2000's avatar
    Shivu-2000
    Icon for Responsive Resident rankResponsive Resident

    Hi nesrinehal20 

     

    You can use switch in this case 

     Slicer_Selected = SELECTEDVALUE('') //This will have your columnn used in slicer and help you to catch which year is sleceted

     

     Dynamic Measure= 
    	Switch(
    		TRUE(),
    		[Slicer_Selected]="2023", [measure you want to use],
    		[Slicer_Selected]="condition 2", [Another measures],
    		[Slicer_Selected]="Condition 3", [Another measure],
    		you can have as many conditions you want
    		[Default value which you want to display if nothing is selected on slicer]
    	)

     

     

    I am personally using it in many reports and it works, let me know if any further help is required.

     

     

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

    • nesrinehal20's avatar
      nesrinehal20
      Frequent Visitor

      i didn't understand, Slicer_selected is year in my case or what..