Forum Discussion

joeytsui's avatar
joeytsui
Icon for Helper I rankHelper I
7 years ago
Solved

% of total

Hi all,

 

i have a file which contain 2018 Jan - Dec and 2019 Jan - Aug sales data.  i add a bar chart by product catalog and seperate 2019 and 2018 by 2 bar, then create 2 slicers (year and month).  then i add %GT Line Value on the tooltips,

when i mouse over 2019 bar, it show the % of the total line value (2018+2019). 

but i want the result is the % of total line value of each year .  thanks in advance.  

 

Joey

  • Hi joeytsui 

     

    You can use ALL() or ALLSELECTED() in your Measure

     

    Best Regards,
    Mariusz

    If this post helps, then please consider Accepting it as the solution.

    Please feel free to connect with me.
    Mariusz Repczynski

     

  • Hi joeytsui,

    Below is my design:

    My sample data 

    year    category      amount       month

    2018 Drink 100 1
    2018 Oil 200 1
    2018 Ice cream 100 1
    2019 Drink 400 1
    2019 Oil 200 1
    2019 Ice cream 200 1
    2018 Drink 100 2
    2018 Oil 300 2
    2018 Ice cream 500 2
    2019 Drink 200 2
    2019 Oil 100 2
    2019 Ice cream 300 2
    2018 Drink 100 3
    2018 Oil 200 3
    2018 Ice cream 100 3
    2019 Drink 200 3
    2019 Oil 600 3
    2019 Ice cream 200 3
    2018 Drink 300 4
    2018 Oil 100 4
    2018 Ice cream 200 4
    2019 Drink 100 4
    2019 Oil 600 4
    2019 Ice cream 500 4

     Then I create a measure like below

    % line =
    SUM ( chart[amount] )
        / CALCULATE (
            SUM ( chart[amount] ),
            FILTER ( ALLSELECTED ( chart ), chart[year] = MIN ( chart[year] ) )
        )
    

    Then use year and month in slicer, you will get the result like below

    Best Regards,
    Zoe Zhi

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

3 Replies

  • Mariusz's avatar
    Mariusz
    Icon for Community Champion rankCommunity Champion

    Hi joeytsui 

     

    You can use ALL() or ALLSELECTED() in your Measure

     

    Best Regards,
    Mariusz

    If this post helps, then please consider Accepting it as the solution.

    Please feel free to connect with me.
    Mariusz Repczynski

     

  • dax's avatar
    dax
    Icon for Community Support rankCommunity Support

    Hi joeytsui,

    Below is my design:

    My sample data 

    year    category      amount       month

    2018 Drink 100 1
    2018 Oil 200 1
    2018 Ice cream 100 1
    2019 Drink 400 1
    2019 Oil 200 1
    2019 Ice cream 200 1
    2018 Drink 100 2
    2018 Oil 300 2
    2018 Ice cream 500 2
    2019 Drink 200 2
    2019 Oil 100 2
    2019 Ice cream 300 2
    2018 Drink 100 3
    2018 Oil 200 3
    2018 Ice cream 100 3
    2019 Drink 200 3
    2019 Oil 600 3
    2019 Ice cream 200 3
    2018 Drink 300 4
    2018 Oil 100 4
    2018 Ice cream 200 4
    2019 Drink 100 4
    2019 Oil 600 4
    2019 Ice cream 500 4

     Then I create a measure like below

    % line =
    SUM ( chart[amount] )
        / CALCULATE (
            SUM ( chart[amount] ),
            FILTER ( ALLSELECTED ( chart ), chart[year] = MIN ( chart[year] ) )
        )
    

    Then use year and month in slicer, you will get the result like below

    Best Regards,
    Zoe Zhi

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