Forum Discussion
Power BI Group Total
- 7 years ago
Anonymous - How about these:
return = VAR __group = MAX('Table17'[Group]) RETURN CALCULATE(SUM(Table17[Total Sales]),Filter(ALLEXCEPT(Table17,Table17[Date]),[Item code]="/return" && [Group]=__group))group total = CALCULATE(SUMX(FILTER(Table17,[Item code]<>"/return"),[Total Sales]),ALLEXCEPT(Table17,Table17[Group],Table17[Date]))
Very minor tweaks.
Attached again, Page 5, Table 17.
Anonymous - How about these:
return =
VAR __group = MAX('Table17'[Group])
RETURN
CALCULATE(SUM(Table17[Total Sales]),Filter(ALLEXCEPT(Table17,Table17[Date]),[Item code]="/return" && [Group]=__group))
group total = CALCULATE(SUMX(FILTER(Table17,[Item code]<>"/return"),[Total Sales]),ALLEXCEPT(Table17,Table17[Group],Table17[Date]))
Very minor tweaks.
Attached again, Page 5, Table 17.
Greg_Deckler
Sorry to bother you again, but I applied the code to my real data, and found 2 problems.
1) the "deduction" (which is same with "return" in my example) seems not working. The correct amount should be -3097.26 for customer ACEHW01. But it seems like it is all broken down? And the total number doesn't match. I screen captured my code so that you can take a look.
2) When I filter by customer using slicer, the group total doesn't work anymore. I chose CustomerNo "ACEHW01" as an example. and the group total breaks as well. The total seems correct though. I screencaptured my code for grouptotal as well.
Do you think you need the original pbix file?
- Anonymous7 years agoNot applicable
- Anonymous7 years agoNot applicable
Greg_Deckler Greg, Any idea for my problem above?
- Greg_Deckler7 years agoCommunity Champion
PBIX would help but I'm thinking that you need to modify your ALLEXCEPT to include customer since you have a customer slicer?
- Anonymous7 years agoNot applicable
Greg_Deckler Is there a way that I can send you the pbix file securely?
- Anonymous7 years agoNot applicable
GilbertQ v-danhe-msft Could you help on solving problem above?
Thank you- GilbertQ7 years agoSuper UserHi there did you try what Greg suggested?
- Anonymous7 years agoNot applicable
GilbertQ
Yes.
But I found 2 more problems
1.Greg's version of "deduction" didn't work. So I modified this to get it work.
deduction = Calculate(SUM(AR_InvoiceHistoryDetail[Total Sales]),
Filter(ALLEXCEPT(AR_InvoiceHistoryDetail,AR_InvoiceHistoryDetail[CustomerNo],
AR_InvoiceHistoryDetail[Invoice Date]),
find("/",AR_InvoiceHistoryDetail[ItemCode], ,0)<>0))
But this doesn't show the amount that I want.But when I unfilter the itemcode to show everything, it shows the correct amount.
This is exactly what I want (group total and deduction value-wise), but I don't want to show the itemcodes that have "/" in the beginning.
2. when I filter by customer through slicer, everything both group total and deduction breaks down. I want them to keep the same amount even when they are filtered through slicer.
Please let me know if anything is not clear.