Forum Discussion

po's avatar
po
Icon for Post Prodigy rankPost Prodigy
7 years ago
Solved

Transpose/unpivot certain columns - displaying as chart

Hi,   Have data of format below   Customer,YrWk,Mon_Delivery_BreadFlag, Tuesday Delivery_Bread_Flag.... Sunday Delivery BreadFlag,Nonday_Delivery_Milk_Flag, Tuesday_Delivery_Milk_Flag.., Sunday D...
  • MFelix's avatar
    7 years ago

    Hi po,

     

    Believe that the best option is on the query editor select the columns of the weekdays flags and unpivoted them you will get a table with the followong format:

    Customer YearWk     Attribute                Flag

    10 201901 Monday_Bread Y
    10 201901 Tuesday_Bread N
    10 201901 Wednesday_Bread Y
    10 201901 Thursday_Bread N
    10 201901 Friday_Bread Y
    10 201901 Saturday_Bread N
    10 201901 Sunday_Bread Y
    10 201901 Monday_Milk Y
    10 201901 Tuesday_Milk N
    10 201901 Wednesday_Milk Y
    10 201901 Thursday_Milk N
    10 201901 Friday_Milk Y
    10 201901 Saturday_Milk N
    10 201901 Sunday_Milk Y
    20 201901 Monday_Bread Y
    20 201901 Tuesday_Bread N
    20 201901 Wednesday_Bread N
    20 201901 Thursday_Bread Y
    20 201901 Friday_Bread Y
    20 201901 Saturday_Bread N
    20 201901 Sunday_Bread N
    20 201901 Monday_Milk Y
    20 201901 Tuesday_Milk Y
    20 201901 Wednesday_Milk Y
    20 201901 Thursday_Milk N
    20 201901 Friday_Milk N
    20 201901 Saturday_Milk N
    20 201901 Sunday_Milk Y

     

    You can then proceed to do more changes as Split row to columns to get the product and the Day of the week, add a number per week day to sort the weekday and then use it on your charts.

     

     

    Check PBIX file attach with all the transformations I refer and a sample chart.

     

    Regards,

    MFelix