Forum Discussion

Rajiv1237's avatar
Rajiv1237
Icon for Resolver I rankResolver I
9 years ago
Solved

Need Following output in PowerBI

1: 2: 3: Wrong  
  • Anonymous's avatar
    Anonymous
    9 years ago

    Hi Rajiv1237,

     

    You can refer to below steps to achieve your requirement.

     

    1. Output needed in PowerBI:

    Drag month to Rows filed, year to Columns fields, year and qty to Values fields.

     

    2. Output Achieved in PowerBI:

    Add a calculate to column to merge month and year.

     

    Sample:

    Date=CONCATENATE([Month]&".",[Year])

     

    Use above calculate column as the Rows of the matrix, year to Columns field, QTY and measure to columns field.

     

    Regards,

    Xiaoxin Sheng

  • Rajiv1237's avatar
    Rajiv1237
    9 years ago

    Issue was with my PowerBI solution:

     

    I have DateKey identity column and I have sorted my Month column with that DateKey.

     

    After removing Month column sorting with DateKey column I got the desired output.

     

    And for sorting Month column instead of identity column I used

    For Month column value January DateKey Column Value =  1

     

    Update Query:

    Update [dbo].[YearQty]
    SET DateKey = CASE
     WHEN [Month] = 'January' THEN 1
     WHEN [Month] = 'February' THEN 2
     WHEN [Month] = 'March' THEN 3
     WHEN [Month] = 'April' THEN 4
     WHEN [Month] = 'May' THEN 5
     WHEN [Month] = 'June' THEN 6
     WHEN [Month] = 'July' THEN 7
     WHEN [Month] = 'August' THEN 8
     WHEN [Month] = 'September' THEN 9
     WHEN [Month] = 'October' THEN 10
     WHEN [Month] = 'November' THEN 11
     WHEN [Month] = 'December' THEN 12
     END