Forum Discussion
Bottom Lines!
I am planning to create a report where I need to show various calculations at the bottom of the tables as shown below.
E.g.
| Region | Sales | Costs | Employees |
| APAC | 60000 | 4000 | 100 |
| EMEA | 30000 | 2000 | 200 |
| USA | 20000 | 1000 | 300 |
| Total | <TOTAL SALES> | <MEDIAN COSTS> | <AVERAGE EMPLOYEES> |
So , how can I start? shall I create a measure? but then how can I show it on the bottom like as in the table above?
- Anonymous5 years ago
Hi Sachy123 ,
Based on my test, since for Sales , the total field is sum(Sales), you could use the default summarization type. And For Costs and Employees ,please try the following formula to create measures:
- Method1:
Costs1 = IF(HASONEVALUE('Table'[Costs]),SUM('Table'[Costs]),MEDIAN('Table'[Costs]))Employees1 = IF(HASONEVALUE('Table'[Employees]),SUM('Table'[Employees]),AVERAGE('Table'[Employees]))- Method2:
Costs2 = IF(ISINSCOPE('Table'[Region]),SUM('Table'[Costs]),MEDIAN('Table'[Costs]))Employees2 = IF(ISINSCOPE('Table'[Region]),SUM('Table'[Employees]),AVERAGE('Table'[Employees]))The final output is shown below:
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- parry2kSuper User
Sachy123 yes you need to create measure and check in the measure if you are at the total line, and one way to do this is by using HASONEVALUE function:
Example measure:
Test Measure = //in this example, if it is on total line it will calculate average otherwise sum IF ( HASONEVALUE ( Table[Region] ), SUM ( Table[Costs] ), AVERAGE ( Table[Costs] ) ) )Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
- AnonymousNot applicable
Hi Sachy123 ,
Based on my test, since for Sales , the total field is sum(Sales), you could use the default summarization type. And For Costs and Employees ,please try the following formula to create measures:
- Method1:
Costs1 = IF(HASONEVALUE('Table'[Costs]),SUM('Table'[Costs]),MEDIAN('Table'[Costs]))Employees1 = IF(HASONEVALUE('Table'[Employees]),SUM('Table'[Employees]),AVERAGE('Table'[Employees]))- Method2:
Costs2 = IF(ISINSCOPE('Table'[Region]),SUM('Table'[Costs]),MEDIAN('Table'[Costs]))Employees2 = IF(ISINSCOPE('Table'[Region]),SUM('Table'[Employees]),AVERAGE('Table'[Employees]))The final output is shown below:
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.