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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

The result doesn't work out when using "VAR" in function

Hi all,

I'm stuck with my DAX as pics below, please help to point out the reason behind. Thank you!!

The main questions I have here are:

  1. Why the "SWITCH" function doesn't work in this case?
  2. Why does group work in pic 1 but pic 2? Do I always have to put all the possible filters when using "VAR" to define the algorithm?   

Please share with me if there are other mistakes I have in the pictures, thank you.

 

↓Expected result but with complicated, messy function.

Pic 1Pic 1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


↓Tried to use "var" to make the function easier to read but failed...

Pic 2Pic 2

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , I think the first argument is missing

 

example

Switch([column],

"Value1", "Result1"

)

 

Switch-Case statement of #PowerBI: https://www.youtube.com/watch?v=gelJWktlR80&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=56

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , I think the first argument is missing

 

example

Switch([column],

"Value1", "Result1"

)

 

Switch-Case statement of #PowerBI: https://www.youtube.com/watch?v=gelJWktlR80&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=56

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.