Forum Discussion

alihijazi's avatar
alihijazi
Helper I
10 years ago
Solved

Help with charts

Hello I'm new to Power BI

I want to create a bar chart by month and display for each month the ratio of sales per month to total sales

Please advise

  • This can totally be done.

     

    First, you'll need a measure to calculate the ratio - I'll break it down into three measures. I'm not sure what your data looks like so I'm going to assume that you have one big table of data that has all of your sales listed by date.

     

    [Sales] = SUM( Sales[Amount] )
    
    [Total Sales] = CALCULATE( [Sales], ALL( Sales[Date] ) )
    
    [Ratio - Sales to Total Sales] = DIVIDE( [Sales], [Total Sales] )

    Second, You'll drag the [Ratio - Sales to Total Sales] onto the dashboard area in Power BI, select bar chart, put the months in the Axis section and you should be good to go.

     

3 Replies

  • austinsense's avatar
    austinsense
    Impactful Individual

    This can totally be done.

     

    First, you'll need a measure to calculate the ratio - I'll break it down into three measures. I'm not sure what your data looks like so I'm going to assume that you have one big table of data that has all of your sales listed by date.

     

    [Sales] = SUM( Sales[Amount] )
    
    [Total Sales] = CALCULATE( [Sales], ALL( Sales[Date] ) )
    
    [Ratio - Sales to Total Sales] = DIVIDE( [Sales], [Total Sales] )

    Second, You'll drag the [Ratio - Sales to Total Sales] onto the dashboard area in Power BI, select bar chart, put the months in the Axis section and you should be good to go.

     

    • alihijazi's avatar
      alihijazi
      Helper I

      thank you for your prompt reply

      Actually I'm expert in QlikView set analysis

      and it seems that DAX is similar to that

       

      so here to ignore dimension in a chart we use All([the dimension to ignore])?

      is this true?

      • austinsense's avatar
        austinsense
        Impactful Individual

        That's exactly right ...

         

        1. CALCULATE() to instruct the measure that you're going to alter the filter - meaning the report will filter the month but you want to ignore that filter.
        2. Just like you said, ALL() to instruct the measure which dimension to ignore.

        You may need to instruct the measure to ignore the month dimension instead of the date dimension.