Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago

Average with categories

Hi,

 

I have a measure which calculates the average and it shows the correct value when i display on the card visual.

However, it shows incorrect values when i place the same measure on Stack Bar Chart or any other visual like table with some dimensions and also have to show values when drilldown it on the dimensions.

 

These are the measures which i am using for card and Stack Bar Chart visual:

 

Average for Card Visual = Divide (TotalCount, TotalYears,0)

Average for Stack Bar Chart Visual = Calculate (Average for Card Visual, ALLEXCEPT('Table', 'Table'[Category1], 'Table'[Category2], 'Table'[Category3]))

 

I am placing measures and dimensions on the stack bar chart like this:

- Category1,Category2,Category3 are placed on Y-axis, 

- Average for Stack Bar Chart Visual on X-axis

- Rating on Legend

 

Can you please suggest what need to done in the measures to get the correct nos. on stack bar chart and which shows correct nos.  as well when drill down it from Category1 to Category2 and then to Category3.

 

Thanks

 

3 Replies

  • Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

    Do not include sensitive information or anything not related to the issue or question.

    If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216

    Please show the expected outcome based on the sample data you provided.

    Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

    • Anonymous's avatar
      Anonymous
      Not applicable

       

      Hi,

      The below is the sample data where first I have to calculate Average (DistinctCount(PST)/DistinctCount(Year)) then i have to show this Average value on a Stack bar chart by placing the measures and fields like this, also this Average should

      show correct values when doing drill down from Main Category to Category to Sub Category:

      Y-axis: Main Category

                 Category

                 Sub Category

      X-axis: Average

      Legend: Ranking

       

       

      Main CategoryCategorySub CategoryPSTRankingYear
      ACCAPAccounting2256_763_4567_OP2256_763_4567_OPMedium2024
      ACCAPAccounting2256_763_4567_OP2256_763_4567_OPMedium2024
      ACCAPIT2256_763_4567_OP2256_763_4567_OPMedium2024
      ACCTSAccounting2256_763_4567_OP2256_763_4567_OPOral2024
      ACCTSDisbursements2256_763_4567_OP2256_763_4567_OPLow2024
      ACCTSDisbursements2256_763_4567_OP2256_763_4567_OPLow2024
      BDBDACommissions2256_763_4567_OP2256_763_4567_OPOral2024
      BDBDACommissions2256_763_4567_OP2256_763_4567_OPOral2023
      BDBDACommissions2256_763_4567_OP2256_763_4567_OPLow2023
      BDFDECommissions2256_763_4567_OP2256_763_4567_OPOral2024
      BDFDESecurity20042256_763_4567_OP5712256_763Best2024
      BDFDESecurity4567_OP39242256_763_4567_OPOPBest2024
      BAALMSBCurrency Exchange Recordkeeping23322256_763_4567_OP6832256_763Best2021
      BAALMSBCurrency Exchange Recordkeeping4567_OP39272256_763_4567_OPOPBest2021
      BAALMSBFinCEN 314(b) Requirements2256_763_4567_OP2256_763_4567_OPMedium2021
      BAALMSBFinCEN 314(b) Requirements2256_763_4567_OP2256_763_4567_OPMedium2025
      BAALMSBFinCEN 314(b) Requirements2256_763_4567_OP2256_763_4567_OPOral2022
      BAALMSBFinCEN 314(b) Requirements2256_763_4567_OP2256_763_4567_OPBest2022
      BAALMSBFinCEN 314(b) Requirements20082256_763_4567_OP5832256_763Low2021
      BAALMSBFinCEN 314(b) Requirements20082256_763_4567_OP5832256_763Low2021

       

      lbendlin coco PBCommunity 

      • lbendlin's avatar
        lbendlin
        Icon for Super User rankSuper User

        Like this?

        And no, Power BI does not support dynamic bucketing. You need to bring your own, predefined buckets.