Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

% Fluctuation

Hi all,

 

I have the following Report:

 

 I want show like this for single selection of product group for A+1

 

 I want show like this for single selection of product group for A+2

 

what ever the percentage it was showing that is fine while we select single product. But I will go to multiple selection for the product groups the % one is getting fluctuating.

 

I need to show the % of individual products based on their respective Revenue, and need to show all the products to gether with respective percentages without fluctuation.

 

Could some one please provide me the solution How can we calculate the percentages values with DAX?.

 

Thanks,

  • Hi, Anonymous,

    try this:

    Percentage =
    VAR _product =
        SELECTEDVALUE ( 'Table'[Product] )
    VAR _product_total =
        CALCULATE (
            SUM ( 'Table'[Revnue] ),
            FILTER ( ALL ( 'Table' ), 'Table'[Product] = _product )
        )
    RETURN
        DIVIDE ( SUM ( 'Table'[Revnue] ), _product_total )
    

     

    Cheers,
    Sturla

    If this post helps, then please consider Accepting it as the solution. Kudos are nice too.

5 Replies

  • sturlaws's avatar
    sturlaws
    Resident Rockstar

    Hi, Anonymous,

    try this:

    Percentage =
    VAR _product =
        SELECTEDVALUE ( 'Table'[Product] )
    VAR _product_total =
        CALCULATE (
            SUM ( 'Table'[Revnue] ),
            FILTER ( ALL ( 'Table' ), 'Table'[Product] = _product )
        )
    RETURN
        DIVIDE ( SUM ( 'Table'[Revnue] ), _product_total )
    

     

    Cheers,
    Sturla

    If this post helps, then please consider Accepting it as the solution. Kudos are nice too.

    • Anonymous's avatar
      Anonymous
      Not applicable

      wow Thanks a lot its working perfect.....you are awesome

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Thanks for providing your great help what ever the solution you provided that is working fine. In the same report we have one more addition can you please look into the issue it's really helpful.

         

        Scenario: In the above scenario earlier it was fluctuating by product now that is resolved. now it is fluctuating to the group. below is the screenshot for reference.

         

        Expected: while selecting both tech and non tesch from the group is is showing 100% while summing up the %. will select only one selection it will not showing 100% we required that based on the selection it should be 100%. expected results

         

        it should be 100% please help me how to achieve that.

         

        Thanks in advnace for providing the solution.

         

         

  • Anonymous's avatar
    Anonymous
    Not applicable

    Can you please look at this issue too, it will be very helpful for us.

     

    Thanks a lot in very advance.