Forum Discussion

AI14's avatar
AI14
Helper III
3 years ago
Solved

combine column data for visualisation

Hi

 

i want to group specific types together and if i wanted to add additional columns to visualisation table it would read behind the group and look at data.

 

i assume its like excel where you write a if and statement but can it be a measure or is it better to a custom column?

e.g

=if(and(types=333,types=339),A330,types

=if(and(types=351,#="min"),A350L,types

 

types>Types
777789
787330
333350
351350L
339 
388 
380 

 

 

#
MIN
GIN
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi AI14 

    Here is the example based on my understanding of the information you have offered.

    You can create a new column, you can use switch() function

     

    Types = SWITCH(TRUE(),OR(Query1[type]=777,Query1[type]=787),"787",OR(Query1[type]=333,Query1[type]=339),"A380",Query1[type]=351,"350")

     

    and I cannot sure that if your "#" is a column in the table above, or a field to be put to a slicer. 

     

    You can refer to the following link to know about switch() function.

    SWITCH function (DAX) - DAX | Microsoft Learn

     

    Best Regards!

    Yolo Zhu

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

3 Replies

    • AI14's avatar
      AI14
      Helper III

      i want the left types to be grouped to the right so i can use a groupe type instead of them individually.

      i tried to do a if(and formula in powerbi but it wouldnt allow me to have more than 2 if's

       

      desired column outcome:

      787 & 777 > 787

      333 & 339 > A380

      351 > 350

      351 + reg > 350L (reg could be on of exampleson the table below the eg "#"

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi AI14 

    Here is the example based on my understanding of the information you have offered.

    You can create a new column, you can use switch() function

     

    Types = SWITCH(TRUE(),OR(Query1[type]=777,Query1[type]=787),"787",OR(Query1[type]=333,Query1[type]=339),"A380",Query1[type]=351,"350")

     

    and I cannot sure that if your "#" is a column in the table above, or a field to be put to a slicer. 

     

    You can refer to the following link to know about switch() function.

    SWITCH function (DAX) - DAX | Microsoft Learn

     

    Best Regards!

    Yolo Zhu

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