Forum Discussion
TotalCost based on Table or Matrix Value
- Anonymous6 years ago
for me to be able to try the formula you supplied, i need to derive number of attendee: i used counifs please sample below
=COUNTIFS(B:B,B2,C:C,C2,A:A,A2),please help with Dax for the countifs
Date Name Status Output 11/06/2019 07:00 CAS Enrolled 9 11/06/2019 07:00 CAS Enrolled 9 11/06/2019 07:00 CAS Enrolled 9 11/06/2019 07:00 CAS Enrolled 9 11/06/2019 07:00 CAS Enrolled 9 11/06/2019 07:00 CAS Enrolled 9 11/06/2019 07:00 CAS Enrolled 9 11/06/2019 07:00 CAS Enrolled 9 11/06/2019 07:00 CAS Enrolled 9 10/06/2019 08:30 PAT Enrolled 6 10/06/2019 08:30 PAT Enrolled 6 PAT Enrolled 0 19/05/2019 23:00 PAT Enrolled 1 10/06/2019 08:30 PAT Enrolled 6 10/06/2019 08:30 PAT Enrolled 6 10/06/2019 08:30 PAT Enrolled 6 10/06/2019 08:30 PAT Cancelled 1 10/06/2019 08:30 PAT Enrolled 6 10/07/2019 23:00 CAS Enrolled 1 10/07/2019 23:00 CAS - CLONED(25/07/2019) Enrolled 2 10/07/2019 23:00 CAS - CLONED(25/07/2019) Enrolled 2 - 6 years ago
Ideally, you should unpivot the table.
https://radacad.com/pivot-and-unpivot-with-power-bi
But if you have current format you can use a measure or column like
sumx(Table,Table[Course Duration]*(Table[Attendees feeding cost]+Table[Location Fees]+Table[Facility Fee]))
sumx(Table,Table[Course Duration]*(Table[Attendees feeding cost]+Table[Location Fees]+Table[Facility Fee])) is not returning the expected result, I think my explanation wasnt clear enough earlier
Derived columns :
FaVeFee = [Duration]*([Locationfee]+[FacilityFee])
FeedingCost = [Duration]*[Output]*[Feeding]
Total = [FaVeFee]+[FeedingCost]
I would like to archive below total with without having to create different colums in other to archive my result. I have attached a screenshot of the visulisation sample that I would like to archieve
| FacilityFee | Feeding | Date | Locationfee | Duration | Name | Status | Output | FaVeFee | FeedingCost | Total |
| 50 | 5 | 11/06/2019 07:00 | 150 | 2.5 | CAS | Enrolled | 9 | 500 | 112.5 | 612.5 |
| 50 | 5 | 11/06/2019 07:00 | 150 | 2.5 | CAS | Enrolled | 9 | 500 | 112.5 | 612.5 |
| 50 | 5 | 11/06/2019 07:00 | 150 | 2.5 | CAS | Enrolled | 9 | 500 | 112.5 | 612.5 |
| 50 | 5 | 11/06/2019 07:00 | 150 | 2.5 | CAS | Enrolled | 9 | 500 | 112.5 | 612.5 |
| 50 | 5 | 11/06/2019 07:00 | 150 | 2.5 | CAS | Enrolled | 9 | 500 | 112.5 | 612.5 |
| 50 | 5 | 11/06/2019 07:00 | 150 | 2.5 | CAS | Enrolled | 9 | 500 | 112.5 | 612.5 |
| 50 | 5 | 11/06/2019 07:00 | 150 | 2.5 | CAS | Enrolled | 9 | 500 | 112.5 | 612.5 |
| 50 | 5 | 11/06/2019 07:00 | 150 | 2.5 | CAS | Enrolled | 9 | 500 | 112.5 | 612.5 |
| 50 | 5 | 11/06/2019 07:00 | 150 | 2.5 | CAS | Enrolled | 9 | 500 | 112.5 | 612.5 |
| 10/06/2019 08:30 | 2.5 | PAT | Enrolled | 6 | ||||||
| 10/06/2019 08:30 | 2.5 | PAT | Enrolled | 6 | ||||||
| PAT | Enrolled | 0 | ||||||||
| 19/05/2019 23:00 | PAT | Enrolled | 1 | |||||||
| 10/06/2019 08:30 | 2.5 | PAT | Enrolled | 6 | ||||||
| 10/06/2019 08:30 | 2.5 | PAT | Enrolled | 6 | ||||||
| 10/06/2019 08:30 | 2.5 | PAT | Enrolled | 6 | ||||||
| 10/06/2019 08:30 | 2.5 | PAT | Cancelled | 1 | ||||||
| 10/06/2019 08:30 | 2.5 | PAT | Enrolled | 6 | ||||||
| 50 | 5 | 10/07/2019 23:00 | 150 | 1 | CAS | Enrolled | 2 | 200 | 10 | 210 |
| 50 | 5 | 10/07/2019 23:00 | 150 | 1 | CA | Enrolled | 1 | 200 | 5 | 205 |
| 50 | 5 | 10/07/2019 23:00 | 150 | 1 | CAS | Enrolled | 2 | 200 | 10 | 210 |
Final Output:
Thanks
- Ashish_Mathur6 years agoSuper User
- Anonymous6 years agoNot applicable
hi Ashish_Mathur , thanks for your, I am trying to use the formula you provide but I am getting attached error message below when I drag the total fee to visual canvas
- Ashish_Mathur6 years agoSuper User
Hi,
In the Query Editor, ensure that all numeric columns are formatted as Decimal numbers.
- Anonymous6 years agoNot applicable
Ashish_Mathur Thanks for your help with this, based on your Pbi file attached, is possible to show correct Row subtotal total . Thanks
- Ashish_Mathur6 years agoSuper User