Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Conditional formatting - IF else - for more than 500 different values

Hey!

Im having some issues with using the "Conditional Column" module, for creating groups from a column containing more than 500 different values.

 

Right now the code for this looks like " else if [Konto] = "20230" then "Eksterne omkostning" else if [Konto] = "20235" then "Eksterne omkostning" else if [Konto] = "20240"" etc. 

 

But I cant figure out how to make it into a shorter and easier to manage code. 

 

 

6 Replies

  • az38's avatar
    az38
    Community Champion

    Hi Anonymous 

    use switch() in DAX, in your case

    Column = SWITCH([Konto],
    "20230", "Eksterne omkostning", 
    "20235", "Eksterne omkostning" ,
    "Other")
    

     solutions for power query will not be very much beautiful 🙂

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Create a second table in Excel or something with the translations between the numbers and the text values. Use a Merge query.