Forum Discussion

VenuDAX's avatar
VenuDAX
New Member
2 years ago

TopN Products contribution by Week wise

Hi everyone,

 

Need to create two visuals - First visual is TopN products sales by time period selection & X-axis is products(Already did).

 

Seconrd visual - TopN product sales contribution out of all products by time period selection & X-axis is Date (Weekly).

 

am providing pbi file in this link.

 

Regards,

Venu

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi VenuDAX ,

     

    You link need access permission. I requested.

    Note that this is a public forum and data should be kept private.

     

    I understand that you are trying to create two visuals in Power BI. The first visual is already done, which shows the TopN products sales by a time period selection with the X-axis as products. Now, you need assistance with creating the second visual, which shows the TopN product sales contribution out of all products by a time period selection with the X-axis as Date (Weekly).

    Since I don't have a data file, I hope the steps below will help you.

    1. Open your Power BI file and go to the report where you want to create the second visual.

    2. Click on the "Visualizations" pane on the right-hand side of the screen.

    3. Click on the "Line and stacked column chart" visual to add it to your report canvas.

    4. Drag and drop the "Date" field to the "Axis" section of the visual.

    5. Drag and drop the "Product" field to the "Legend" section of the visual.

    6. Drag and drop the "Sales" field to the "Values" section of the visual.

    7. In the "Visualizations" pane, click on the "Format" section to customize the visual.

    8. Under the "Data labels" section, enable the "Data label" option to show the sales contribution on the visual.

    9. Adjust the formatting and styling of the visual as per your preference.

    10. Save and publish the report to share it with others. This should create the second visual that shows the TopN product sales contribution out of all products by a time period selection with the X-axis as Date (Weekly).

     

    Best Regards,

    Stephen Tao

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.           

    • VenuDAX's avatar
      VenuDAX
      New Member

      Anonymous  Thanks for reply. granted access the file now.

      Please help on it.

       

      Thanks in advance.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi VenuDAX ,

     

    I found out that because you use ALLSELECTED( 'Orders'[Product ID]), your TopN Products measure ignores the filtering of the [End of Week] field when setting Top N slicer on the second chart.

    You can create a new measure as

    TopN Products new = 
    VAR SelectedTop = SELECTEDVALUE('TopN'[TopN])
    RETURN
    SWITCH(TRUE(),
        SelectedTop = 0, [Total Sales],
        RANKX ( 
                ALLSELECTED(  'Orders'[End of Week]), 
                [Total Sales]
                    )
                      <= SelectedTop,
            [Total Sales]
    )
    

    In your second visual, replace the TopN Products measure with the opN Products new measure.

    You can download my attachment for more details.

     

    Best Regards,

    Stephen Tao

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.