Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Switch statement to return chat values

hello all,

 

i have this sample data in Power BI:

 

UsersSalesmembersManagersCarsPhonesExpensespagers
10,2051,5005002,0002,0001,5031,500

 

What I am trying to create is a chart like this:

 

What I have done is created a disconnected table with all the categories and placed that measure in the axis.

Category
Users
Salesmembers
Managers
Cars
Phones
Expenses
pagers

Now I need to use a DAX meaure to place in the visual to return the correct values.

 

how can I do this with DAX? 

 

  • Anonymous's avatar
    Anonymous
    6 years ago

    yes! thank you so much

  • smpa01's avatar
    smpa01
    6 years ago

    One thing, for you to display the CATEGORY level - managers, cats etc etc on the X axis, DAX would need a table that contains those values in a single column.

     

    You can either achieve it by creating a table on-the-fly like I did and have the visual created form table 2 or by creating a disconnected table as DCN in the example and then SWITCH !!!! 😂😂

     

15 Replies

  • smpa01's avatar
    smpa01
    Community Champion

    I am not sure whether you wanted PBI to render the chart or want a switch statement. PowerBI can return the same chart without needing a switch at all.

    • Anonymous's avatar
      Anonymous
      Not applicable

      the reason I wanted to use a switch statement is because I have a lot of other data in my file and I dont want to mess up any other visuals if I were to pivot this data