Power BI Custom Subtotals

smitpau

Board Regular
Joined
Apr 2, 2020
Messages
167
Office Version
  1. 365
Platform
  1. Windows
Hi,

I'd like to be able to create custom subtotals for say Total Revenue based on other values.

I'm using the idea from the video linked below to do this using a SWITCH function.

The irony is the normal values pull through okay, it's the [Total Rev] value that doesn't, which is strange as the card shows the correct value.

How To Create Unique Subtotals In Power BI Tables Using DAX - YouTube

Any help is appreciated.

File is also linked below if it's easier to go through that way, basically the Total Rev figure is 1,000 which doesn't map to the Total Revenue line.


My code:

Selected Year =
VAR CurrentItem = SelectedValue (Sheet1[P&L ])
RETURN
SWITCH( TRUE (),
CurrentItem = "Total Revenue",[Total Rev],
calculate ([Values v2],
filter (Sheet1,Sheet1[P&L ]=CurrentItem)))
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
So to summarise the problem as I may not have explained it well initially.

The switch doesn't switch to a measure for some reason i.e. the first line below works and shows 1,000 but the second line is blank even though the measure is defined.

CurrentItem = "Total Revenue","1000",
CurrentItem = "Total Revenue",[Total Rev],
 
Upvote 0
If anybody has a solution to this I'll happy.

Thanks
 
Last edited by a moderator:
Upvote 0

Forum statistics

Threads
1,224,817
Messages
6,181,149
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top