Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

How to calculate an average for a category in a granular table

Hi folks,

 

I need some urgent help in calculating the average age of case per month and by category from a granular table.

The calculation that i am using is showing me the same value for all months. Visula below.

CALCULATE(
AVERAGEX(
KEEPFILTERS( VALUES('Case'[Case ID])),
        AVERAGE('Case'[Case Age])),
           FILTER('Case','Case'[New Value] ="Trans"||
          'Case'[Old Value] ="Trans"))
incorrect result.PNG
As an example my table looks similar to the picture below..

table.PNG
Matrix desired like the below screen grab..
Matrix required.PNG


 

 

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

HI @Anonymous ,

You can try to use the following measures if they suitable for your requirement:

AVG Score =
CALCULATE (
    AVERAGE ( Table[Score] ),
    ALLSELECTED ( Table ),
    VALUES ( Table[PatientID] ),
    VALUES ( Table[Patient name] )
)

Count Patient =
CALCULATE (
    Countrows(Table),
    ALLSELECTED ( Table ),
    VALUES ( Table[PatientID] ),
    VALUES ( Table[Patient name] )

If above not help, can you please share some sample data for test?

How to Get Your Question Answered Quickly

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

4 REPLIES 4
v-shex-msft
Community Support
Community Support

HI @Anonymous ,

You can try to use the following measures if they suitable for your requirement:

AVG Score =
CALCULATE (
    AVERAGE ( Table[Score] ),
    ALLSELECTED ( Table ),
    VALUES ( Table[PatientID] ),
    VALUES ( Table[Patient name] )
)

Count Patient =
CALCULATE (
    Countrows(Table),
    ALLSELECTED ( Table ),
    VALUES ( Table[PatientID] ),
    VALUES ( Table[Patient name] )

If above not help, can you please share some sample data for test?

How to Get Your Question Answered Quickly

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
waltheed
Solution Supplier
Solution Supplier

Hi ChristoR1,

 

If you see the same values for every row, you always need to check if there is a relationship. In this case between the months and the cases. Can you share your data model?

Cheers, Edgar Walther
ITsmart BI and Analytics consultant
Anonymous
Not applicable

Hi, there is a one is to many relationship between the case and the calendar table. Also it is unlikely to be the relationship as the other case measures as you can see in the table work just fine except for the measures calculations which is likely to be the dax!

OK, let me rephrase this... the relationship is currently not used in your dax formula.

If you share your data model I may be able to help sort it out.  Can you send a small pbix file?

Cheers, Edgar Walther
ITsmart BI and Analytics consultant

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors