Forum Discussion

StraighterSwing's avatar
StraighterSwing
Regular Visitor
2 years ago
Solved

How can I combine multiple row values into 1

Newbie here.   I have a table that has an ApptStatus column.  Among others, there are 3 that start with "Cancelled....". 

  1. Cancelled by Client
  2. Cancelled By Vendor
  3. Cancelled Due To Technical Issues

How can I combine\sum these into 1 value called "All Cancelations" so the BarChart only has 1 bar for this instead of 3 separate ones?

  • Hi,

    "Use the Switch young Jedi". Joke aside, create a new column as follows:

    New Status = SWITCH(
    TRUE(),
    Table[ApptStatus] = "Cancelled by Client", "All Cancellations",
    Table[ApptStatus] = "Cancelled by Vendor", "All Cancellations",
    Table[ApptStatus] = "Cancelled Due To Technical Issues", "All Cancellations",
    Table[ApptStatus])

     

    If this answered your question, please mark it as the solution.

3 Replies

  • MNedix's avatar
    MNedix
    Icon for Solution Sage rankSolution Sage

    Hi,

    "Use the Switch young Jedi". Joke aside, create a new column as follows:

    New Status = SWITCH(
    TRUE(),
    Table[ApptStatus] = "Cancelled by Client", "All Cancellations",
    Table[ApptStatus] = "Cancelled by Vendor", "All Cancellations",
    Table[ApptStatus] = "Cancelled Due To Technical Issues", "All Cancellations",
    Table[ApptStatus])

     

    If this answered your question, please mark it as the solution.

  • Hi,

    Write this calculated column formula

    Column = if(containsstrng(Data[AppStatus],"Cancelled"),"All cancellations",blank())

    Hope this helps.

  • I wish I could accept both answers as the solution as both worked great.  I also learned a lot about PowerBI with just these 2 responses.  I did upvote both answers though. 

    Ashish's response was concise and simple and 100% functional (thank you!).  However, I selected MNedix's response as it too was 100% functional, but seems to be more versatile and flexible for other uses.  Also, even though there was a working answer, MNedix offered an additional alternative answer and didn't really have to.

     

    Thank you to the both of you!