Forum Discussion

JamesBurke's avatar
JamesBurke
Icon for Helper III rankHelper III
1 year ago
Solved

Switch function

Hi All ,    Using the swtich function to swtich measure based on what building is selected but when blank i would like it to be another Measure.   cc 34 = SWITCH( MAX('Emporia Devices'[Wawr...
  • ajohnso2's avatar
    1 year ago

    Since you have not attached a sample pbix. Please try..

     

    edit: Re-read requirement, please try...

     

     

    cc 34 =
    VAR _Selected = SELECTEDVALUE('Emporia Devices'[Wawrick Device Name (groups)], "") // This should be a value that doesnt exist in [Wawrick Device Name (groups)] "" should be sufficient, effectively setting to a non value producing BLANK results
    SWITCH(
        _Selected,
       "N1 Kings High School",[Total Consumption],
        "Bridge Theatre",[Total Consumption],
        "Warwick Sport Centre",[Total Consumption],
        "Cheshire science",[Total Consumption],
        "Gibson Building",[Total Consumption],
        "Junior Music Block",[Total Consumption],
        "Macefield Building",[Total Consumption],
        "Main School",ROUND([Main School - Art & Design],2),
        "N3 Prep School Music",[Total Consumption],
        "Kings Pavillion",[Total Consumption],
        "Thornton Building",[Total Consumption],
        "Warwick Hall",[Total Consumption],
        "Bridge Sports Centre",[Total Consumption],
        "Estates",[Total Consumption],
        "Junior School",[Total Consumption],
        "Nursery",[Total Consumption],
        "Prep School",ROUND([Prep - BSP 1 & Nursery],2),
        "Sixth Form",[Total Consumption],
        "Art and Design",ROUND([Art Design - MFL , Humanities & Thorton],2),
        "N2 Bridge Extension" , [Total Consumption],
        "Junior Assembly",[Total Consumption],
        "kitchens",[Total Consumption],
        "Humanities",[Total Consumption],
        "MFL" , [Total Consumption],
    "", [New Total Consumption]
    
    )