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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

PRIORITY Number Change and create new column based which number in first position instead one

I have a dataset with two columns. If the "Priority" column has a value of 1, it should be changed to any other number, for example, if it's changed to 3, then 1 will be changed to 3, and 3 will be changed to 1. I have attached a sample data with the desired output.

 

TASKNO   PRIORITY
1                 1
2                2
3                3
4                4
5               5

IF PRIORITY ORDER IF I CHANGE 1 TO 5 .. I WANT OUTPUT LIKE


TASKNO            PRIORITY         TO CHANGE

1                              1                      5
2                              2                     2
3                              3                    3
4                             4                    4
5                            5                      1

 

IF PRIORITY ORDER IF I CHANGE 1 TO 3 .. I WANT OUTPUT LIKE


TASKNO   PRIORITY       TO CHANGE

1                  1                        3
2                 2                         2
3                 3                         1
4                 4                        4
5                 5                       5

 


IF PRIORITY ORDER IF I CHANGE 1 TO 4 .. I WANT OUTPUT LIKE


TASKNO       PRIORITY      TO CHANGE

1                      1                        4
2                     2                         2
3                     3                         3
4                     4                        1
5                    5                         5                                                                                                                                                                  Thanks in advance . 

1 REPLY 1
ERD
Community Champion
Community Champion

Hi @Anonymous ,

You can try the measure:

TO CHANGE = 
VAR _priority =
    SELECTEDVALUE ( priority[PRIORITY] )
VAR _priorityToChange =
    SELECTEDVALUE ( 'table'[PRIORITY] )
RETURN
    SWITCH ( _priorityToChange, 1, _priority, _priority, 1, _priorityToChange )

ERD_0-1699036512043.pngERD_1-1699036520285.png

Out of curiosity, what's the real life usage?

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.