# How to get Total line from total of measures

Hi Team,
I used the following measure for MTD results.

MTD Cor Act =

VAR CurrentItem = SELECTEDVALUE(CorporateReport[Corporate])

RETURN

SWITCH(TRUE(),

CurrentItem = “Income”, TOTALMTD([Cor Act Income], DateTable[Date]),

CurrentItem = “Labour Cost”, TOTALMTD([Cor Act Labour Cost],DateTable[Date]),

CurrentItem = “Non-Operating Expenditure”, TOTALMTD([Cor Act Non-Operating Expenditure],DateTable[Date]),

CurrentItem = “Other Expenditure”, TOTALMTD([Cor Act Other Expenditure],DateTable[Date]),

CurrentItem = “Support Service Recharge”, TOTALMTD([Cor Act Support Service Recharge],DateTable[Date]),

Blank ())

As you can see in the following screen shot, I am not sure how to get total figure. I have all the measures with no formatting as you can see. Please feel free to correct my measure to have the total figure.
Thank you.

regards,
Ammu

Hello @ammu,

Thank you for posting your query onto the Forum.

You can calculate the “Total” value by using the below formula in your analysis.

For example -

``````Income MTD =
CALCULATE( [Cor Act Income] ,
FILTER( Dates ,
Dates[Date] >= DATE( YEAR( Dates[Date] ) , MONTH( Dates[Date] ) , 1 ) ) ,
FILTER( Dates , Dates[Date] < DATE( YEAR( Dates[Date] ) , MONTH( Dates[Date] ) , TODAY() ) ) )
``````

Alternatively, you can also use this formula as well -

``````Income MTD =
SUMX( Sales , CALCULATE( [Total Sales] ,
DATESMTD( Dates[Date] ) ) )
``````

Similarly, you can also follow the same approach for others as well.

I’m attaching the screenshot as well the PBIX file of my working for the reference.

Hoping you find this useful and helps you to achieve the desired analysis.

Please feel free to write back in case I’ve missed out anything.

Thanks & Regards,
Harsh

Dynamic Comparison based on Month, Quarter and Year.pbix (524.3 KB)

Hi Harsh,
Many thanks for sharing with me for your working.
I can now attached your Pbix file and please let me know how to get the total on the slide.
I am ok with short month total for MTD, QTD and YTD etc.

I am aware that data type for Total sales are different in your data. But my data have the same data type and I should be able to add them together.

Thank you.
Regards,
ammu

Hello @ammu,

I’m attaching the screenshot as well as the PBIX file of my working.

Hoping you find this useful and helps you to achieve your desired analysis.

Please feel free to write in case I’ve missed out anything.

Please Note: I’ve worked out the Total for Total Sales in my working the same procedure can be followed for other Fields as well.

Thanks & Warm Regards,
Harsh

1 Like

Many thanks, Harsh.
so that it is just to add 2 measures. I will try that tomorrow.
Good night for now.
Regards,
Aye

Please be sure to check out our DAX Clean Up tool it’s a great way to ensure to make your DAX code easy to read. Thanks!

https://analysthub.enterprisedna.co/dax-clean-up