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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Ferri
Advocate I
Advocate I

Cannot Post from Power BI Desktop

Hi,

I have a number of values that I want to group in power bi desktop query.

how do I do it in power bi desktop query. see an example below

 

somthing like this in dax powerpivot

If (myColumn < 1100,1000,If myColumn < 1200,1100,.....)

 

Any advice please?

 

Many thanks,

Ferri

 

                            Output should be like this

My Column           NyCoulumn

1000                     1000 

1001                     1000

1005                     1000

1020                     1000

1100                     1100

1106                     1100 

1155                     1100

1200                     1200

1210                     1200

1285                     1200

1247                     1200

10000                   10000

10025                   10000

 

 

 

1 ACCEPTED SOLUTION

@Ferri SWITCH does compare the values...

It takes the initial column value that you want to compare, and will evaluate each value on the expression list you define. Then replacing the value range to the static value you want..

 

Here is an example of using this in a calculated column which you can name "NyCoulumn"

SWITCH(TRUE(),
AND([MyColumn] >=0, [MyColumn] <=1099), "1000"
AND([MyColumn] >=1100, [MyColumn] <=1199), "1100"
AND([MyColumn] >=1200, [MyColumn] <=1299), "1200"
"1200+"

 

 


Looking for more Power BI tips, tricks & tools? Check out PowerBI.tips the site I co-own with Mike Carlo. Also, if you are near SE WI? Join our PUG Milwaukee Brew City PUG

View solution in original post

3 REPLIES 3
Ferri
Advocate I
Advocate I

thanks for the help, but I need to compare the values therefore i will use if..else.

 

@Ferri SWITCH does compare the values...

It takes the initial column value that you want to compare, and will evaluate each value on the expression list you define. Then replacing the value range to the static value you want..

 

Here is an example of using this in a calculated column which you can name "NyCoulumn"

SWITCH(TRUE(),
AND([MyColumn] >=0, [MyColumn] <=1099), "1000"
AND([MyColumn] >=1100, [MyColumn] <=1199), "1100"
AND([MyColumn] >=1200, [MyColumn] <=1299), "1200"
"1200+"

 

 


Looking for more Power BI tips, tricks & tools? Check out PowerBI.tips the site I co-own with Mike Carlo. Also, if you are near SE WI? Join our PUG Milwaukee Brew City PUG
Seth_C_Bauer
Community Champion
Community Champion

@Ferri you could use an "IF", but SWITCH is less verbose.

Check out this blog to guide you, and help you understand how to do this now and in future cases.

http://www.powerpivotpro.com/2012/06/dax-making-the-case-for-switch/


Looking for more Power BI tips, tricks & tools? Check out PowerBI.tips the site I co-own with Mike Carlo. Also, if you are near SE WI? Join our PUG Milwaukee Brew City PUG

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.