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

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Variables using Switch True

Hi, 

I would like to make variables on sales using the North Wind database. But when trying to use the Var_salg column all of my products are placed in group "D: Over 10000"

Var_salg =
VAR Val =
SUMX(Order_Details;Order_Details[UnitPrice]*Order_Details[Quantity])
Return
SWITCH(TRUE();

 

Val <=1000; "A: 0-1000";
Val <=5000; "B: 1001-5000";
Val <=10000; "C: 5001-10000";
Val >10000; "D: Over 10000")


 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

It works now. 

 

I simply created a SUMX measure for "I alt salg":

Var_salg =
VAR Val =
[I alt salg]
Return
SWITCH(TRUE();
Val <=1000; "A: 0-1000";
Val <=5000; "B: 1001-5000";
Val <=10000; "C: 5001-10000";
Val >10000; "D: Over 10000")

View solution in original post

3 REPLIES 3
v-chuncz-msft
Community Support
Community Support

@Anonymous 

 

It seems that you'll need to add RELATEDTABLE.

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

Hi @v-chuncz-msft 
How do you mean?

Anonymous
Not applicable

It works now. 

 

I simply created a SUMX measure for "I alt salg":

Var_salg =
VAR Val =
[I alt salg]
Return
SWITCH(TRUE();
Val <=1000; "A: 0-1000";
Val <=5000; "B: 1001-5000";
Val <=10000; "C: 5001-10000";
Val >10000; "D: Over 10000")

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.