cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Chanleakna123 Post Prodigy
Post Prodigy

Calculate Total by categories on measure on table

1.PNG

 

Hi , i have above table. I'd like to sum by code such as what is the total of OP , EP , PM , PS by date. do we have any way to create another measure ? because the total of OP , EP , PM , PS will be calculated to another table. 
your response is much apprecaited. 
Thx 

1 ACCEPTED SOLUTION

Accepted Solutions
Moderator v-qiuyu-msft
Moderator

Re: Calculate Total by categories on measure on table

Hi @Chanleakna123,

 

I have looked into your pbix file. I modified the relationships in attached file. When you create relationships, you can refer to this document firstly: https://docs.microsoft.com/en-us/power-bi/desktop-create-and-manage-relationships

 

The error you get last time due to 'EPL'[Code]' is not number data type, so we can't use sum() function. The updated measure below: 

 

Total By Group = CALCULATE(SUM('Downtime Record (2)'[Minute ]);FILTER(ALLSELECTED('Downtime Record (2)');CONTAINS(FILTER(ALL(EPL);EPL[Code ]=MAX(EPL[Code ]));EPL[SAP Code];'Downtime Record (2)'[EPL])))

 

q1.PNG

 

Best Regards,
Qiuyun Yu 

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Moderator v-qiuyu-msft
Moderator

Re: Calculate Total by categories on measure on table

Hi @Chanleakna123,

 

You can create a measure below: 

 

TotalGroupByCode= calculate(sum([Minute]),filter(all('Downtime Record(2)'),[Code]=MAX([Code])))

 

Best Regards,
Qiuyun Yyu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Chanleakna123 Post Prodigy
Post Prodigy

Re: Calculate Total by categories on measure on table

HI @v-qiuyu-msft
it works on the measure , but when i include in the table , It doesn't work. 
1.PNG

Moderator v-qiuyu-msft
Moderator

Re: Calculate Total by categories on measure on table

Hi @Chanleakna123,

 

Would you please share the pbix file with us? You can upload to your OneDrive and send the link tome via private message. Thanks. 

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Chanleakna123 Post Prodigy
Post Prodigy

Re: Calculate Total by categories on measure on table

Moderator v-qiuyu-msft
Moderator

Re: Calculate Total by categories on measure on table

Hi @Chanleakna123,

 

I have looked into your pbix file. I modified the relationships in attached file. When you create relationships, you can refer to this document firstly: https://docs.microsoft.com/en-us/power-bi/desktop-create-and-manage-relationships

 

The error you get last time due to 'EPL'[Code]' is not number data type, so we can't use sum() function. The updated measure below: 

 

Total By Group = CALCULATE(SUM('Downtime Record (2)'[Minute ]);FILTER(ALLSELECTED('Downtime Record (2)');CONTAINS(FILTER(ALL(EPL);EPL[Code ]=MAX(EPL[Code ]));EPL[SAP Code];'Downtime Record (2)'[EPL])))

 

q1.PNG

 

Best Regards,
Qiuyun Yu 

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Top Solution Authors
Top Kudoed Authors