cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
christoR1 Regular Visitor
Regular Visitor

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

Accepted Solutions
Community Support Team
Community Support Team

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

HI @christoR1 ,

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 Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.



For learning resources/Release notes, please visit: | |

View solution in original post

4 REPLIES 4
waltheed
Advisor

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

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
Power BI User Group Netherlands
Highlighted
christoR1 Regular Visitor
Regular Visitor

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

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!
waltheed
Advisor

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

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
Power BI User Group Netherlands
Community Support Team
Community Support Team

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

HI @christoR1 ,

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 Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.



For learning resources/Release notes, please visit: | |

View solution in original post

Helpful resources

Announcements
Ask Amanda Anything Q&A

Ask Amanda Anything Q&A

Learn the answers to some of the questions asked during the Amanda Triple A event.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 387 members 3,556 guests
Please welcome our newest community members: