Forum Discussion
Sum Measure from a aggregated summarize column
Hi all,
I know this could be a basic question, but as I'm new on this Dax I would like to ear from you a solution for my question :
I have the follow :
SUMMARIZECOLUMNS(
FTPlacementHours[JobId],
FTPlacementHours[PotentialHours],
dimCalendar[WeekEndingDateFriday],
KEEPFILTERS(TREATAS({"2024-09-06", "2024-09-13", "2024-09-20", "2024-09-27"},dimCalendar[WeekEndingDateFriday])),
KEEPFILTERS(TREATAS({95976},FTPlacementHours[JobId]))
)
My result is :
JobId Potentialhours WeekEndingDateFriday
95976 | 10.000000 | 2024-09-06
95976 | 10.000000 | 2024-09-13
95976 | 10.000000 | 2024-09-20
95976 | 10.000000 | 2024-09-27
My Question : How I can return the sum of all Potentialhours to present in a card in PBI?
I will appreciate some help !
Thanks
Pedro
- Anonymous1 year ago
Hi , My appologise,
My base data is for one use case jobid 95676
JobId | Potentialhours | Session_StartDate | WeekEndingDateFriday
95976 | 10.000000 | 2024-09-16 | 2024-09-20
95976 | 10.000000 | 2024-09-13 | 2024-09-13
95976 | 10.000000 | 2024-09-17 | 2024-09-20
95976 | 10.000000 | 2024-09-09 | 2024-09-13
95976 | 10.000000 | 2024-09-18 | 2024-09-20
95976 | 10.000000 | 2024-09-04 | 2024-09-06
95976 | 10.000000 | 2024-09-12 | 2024-09-13
95976 | 10.000000 | 2024-09-26 | 2024-09-27Then I need to Gregate this data per week
JobId | Potentialhours | WeekEndingDateFriday
95976 | 10.000000 | 2024-09-20
95976 | 10.000000 | 2024-09-13
95976 | 10.000000 | 2024-09-06
95976 | 10.000000 | 2024-09-27
At the End I would like to get a card with a measure that gives me 40 as total or a total of all jobs ID
8 Replies
- Greg_Deckler
Community Champion
Anonymous Try:
Measure = SUMX( SUMMARIZECOLUMNS( FTPlacementHours[JobId], FTPlacementHours[PotentialHours], dimCalendar[WeekEndingDateFriday], KEEPFILTERS(TREATAS({"2024-09-06", "2024-09-13", "2024-09-20", "2024-09-27"},dimCalendar[WeekEndingDateFriday])), KEEPFILTERS(TREATAS({95976},FTPlacementHours[JobId])) ), [Potentialhours] )- AnonymousNot applicable
Is great ! Thank you for your quick answare. But when I remove the filter gives me complete different values. this is what block me!
I mean when I remove the line KEEPFILTERS(TREATAS({95976},FTPlacementHours[JobId])) , because I was testing one unique case with jobid 95976. and with dates as filter
- Greg_Deckler
Community Champion
Anonymous Well, yes, if you remove the filters then you will get a different table back which will give you a different sum. Would need to understand what you are trying to accomplish.
Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882
Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.
- AnonymousNot applicable
Hi Anonymous ,
Thank you for reaching out to the Microsoft Fabric Community.
To get the correct total in a card (e.g., 10 per week across 4 weeks = 40), you'll want to avoid double-counting session rows and instead aggregate by week. Please try the following measure:
TotalPotentialHours := SUMX( SUMMARIZE( FTPlacementHours, FTPlacementHours[JobId], dimCalendar[WeekEndingDateFriday], "WeeklyPotential", MAX(FTPlacementHours[PotentialHours]) ), [WeeklyPotential] )This groups by JobId and WeekEndingDateFriday, takes one PotentialHours value per week (using MAX), and sums across all weeks.
If you need to apply filters like specific dates or JobId, you can adapt it with SUMMARIZECOLUMNS and TREATAS as you were doing earlier.
I hope this could reslove your issue, if you need any further assistance, feel free to reach out.
If this post helps, then please give us Kudos and consider Accept it as a solution to help the other members find it more quickly.
Thank you.
- AnonymousNot applicable
Hi Anonymous ,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.
- AnonymousNot applicable
Hi @pjm ,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you. - AnonymousNot applicable
Hi Anonymous ,
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.