Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jadhav_vilas84
Advocate II
Advocate II

manage 12 month column and year column into Power Bi desktop application

Dear Sir, 

 

Please help , I have data sheet as below . How can i manage into power Bi and shows month wise and year wise product sales 

 

Territory_CodeRegion_CodeZone_CodeProduct Bussiness  CFY_Apr_AnnualPlan_Qty  CFY_Apr_Expected_Qty  CFY_Apr_Actual_Sales_Qty  CFY_Apr_AnnualPlan_Value  CFY_Apr_Expected_Value  CFY_Apr_Product_sales  CFY_Apr_Product_Return  CFY_Apr_Product_Bill_Price  LFY_Apr_AnnualPlan_Qty  LFY_Apr_Expected_Qty  LFY_Apr_Actual_Sales_Qty  LFY_Apr_AnnualPlan_Value  LFY_Apr_Expected_Value  LFY_Apr_Product_sales  LFY_Apr_Product_Return  LFY_Apr_Product_Bill_Price 
41003030007Tomato  10000000000000000
41003030007brinjal                10000000000000000
41003030007ALLQUIT             10000000000000000
41003030007carrot             120015508600495000495002001550860049500049500
41003030007Bajra             1001000440004400001000440004400
                     
1 ACCEPTED SOLUTION

@jadhav_vilas84

 

In this scenario, you need to unpivot the CFY/LFY_Month_*** columns and add a separated Date column. Then add a column to store the rank number of product sales in each month.

Please refer to following steps.

 

  1. In Query Editor, select all the CFY/LFY_Month_*** columns and click “Unpivot Columns”.
    1.jpg
  2. Select the ‘Attribute’ column above and click “Split Column by Delimiter” with custom delimiter ‘_’. Repeat once for the ‘Attribute.2’ column.
    2.jpg
  3. Select the ‘Attribute.1’ column and replace CFY with 2016 and LFY with 2015.
  4. Select two columns of ‘Attribute.1’ and ‘Attribute.2.1’ and click “Merge Columns” with separator ‘Space’. Change this merged column type to “Date”.
    3.jpg
  5. Change the name of ‘Attribute.2.2’ to ‘Type’. Close and apply Query Editor.
    5.jpg
  6. Add a column to store the rank number of product sales in each month with below formula.
    Rank_In_Type = 
    RANKX (
        FILTER (
            Table1,
            EARLIER ( Table1[Type] ) = Table1[Type]
                && EARLIER ( Table1[Date] ) = Table1[Date]
        ),
        Table1[Value]
    )
    
  7. Drag slicers and Clustered column chart into your canvas.
    7.jpg

 

Regards,

View solution in original post

4 REPLIES 4
v-sihou-msft
Employee
Employee

@jadhav_vilas84

 

Your requirement is not clear to me. It seems that you want the monthly sales and yearly sales. But I only find the product total sales of CFY and LFY in your data sheet.

Could you please describe it more clearly with expected result will be preferred.

 

Regards,

Dear Sir, 

 

I have Product sales and product returns data for Current Year with month like CFY_Apr_Product_sales  and last year with month  like (LFY_Apr_Product_sales ) , so I have total  24 columns for Product_sales , and it is based on folowing columns

Territory_CodeRegion_CodeZone_CodeProduct

  

How can I manage this data in Power BI desktop application , Please guide. I want to  filter it using power Query like show top 10 territories product sales in may 2016 or more way.

 

Please guide for this.

 

thanks

vilas  jadhav

 

@jadhav_vilas84

 

In this scenario, you need to unpivot the CFY/LFY_Month_*** columns and add a separated Date column. Then add a column to store the rank number of product sales in each month.

Please refer to following steps.

 

  1. In Query Editor, select all the CFY/LFY_Month_*** columns and click “Unpivot Columns”.
    1.jpg
  2. Select the ‘Attribute’ column above and click “Split Column by Delimiter” with custom delimiter ‘_’. Repeat once for the ‘Attribute.2’ column.
    2.jpg
  3. Select the ‘Attribute.1’ column and replace CFY with 2016 and LFY with 2015.
  4. Select two columns of ‘Attribute.1’ and ‘Attribute.2.1’ and click “Merge Columns” with separator ‘Space’. Change this merged column type to “Date”.
    3.jpg
  5. Change the name of ‘Attribute.2.2’ to ‘Type’. Close and apply Query Editor.
    5.jpg
  6. Add a column to store the rank number of product sales in each month with below formula.
    Rank_In_Type = 
    RANKX (
        FILTER (
            Table1,
            EARLIER ( Table1[Type] ) = Table1[Type]
                && EARLIER ( Table1[Date] ) = Table1[Date]
        ),
        Table1[Value]
    )
    
  7. Drag slicers and Clustered column chart into your canvas.
    7.jpg

 

Regards,

Dear sir, 

 

 

My issue is resolve ,  thanks very much .

 I m not able to use rankx for serching top 10 products for sale. using power Query on dashboard , I m not able to search top 10 products whoes sales is heigh. Can you Please help me. 

 

thanks 

vilas jadhav

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.