Forum Discussion
Custom Year to Date Flag
Hi Andrew_Butcher,
Why do you want to use the calculated column?
you can calculate it on a measure, with DAX function TOTALYTD
see definition
TOTALYTD(<expression>,<dates>[,<filter>][,<year_end_date>])
see example
TOTALYTD(SUM(InternetSales_USD[SalesAmount_USD]),DateTime[DateKey], ALL('DateTime'), "6/30") **In this example, year_end_date can be specified as "6/30"
linked to Microsoft DAX function https://learn.microsoft.com/en-us/dax/totalytd-function-dax
if you have more then one measure,
you can use Calculation Group - it will activate the YTD function on all measures
Good Luck
---------------------------------------------------------------------------------------------------------------------
If you find this helpful, kindly consider marking it as 'Accepted Solution.'
This action helps others quickly find a reliable answer!
Hi oritam3210, thanks for your reply. I had seen that way if doing things, but ideally I want to create the column so it will dynamically flag each date to be included in the custom YTD or not, changing daily. I could then use that as a slicer so I can switch the YTD on or off on a page of my dashboard to flick between the two views, rather than have to have two separate visuals. Do you know of a way I could achieve this? Thanks
- oritam32102 years ago
Helper I
Hi Andrew_Butcher,
Do you want the column to be able to create a filter?if so, you can achieve this exact functionality by using calculation groups.
you can create two calculation items, one does nothing (YTD off), and one manipulates all the measures on the report to custom YTD behavior.BTW - there is a new look for calculation group in Power BI, see this link.
I think that a quick solution for your case,
Good Luck!
---------------------------------------------------------------------------------------------------------------------
If you find this helpful, kindly consider marking it as 'Accepted Solution.'
This action helps others quickly find a reliable answer!