Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

YTD on card visual without date slicer/filter

Hi,

Is there any way to show YTD on card visual without using date reference (slicer/filter)?

It shows blank on card visual untill any date reference not provided.

 

 

YTD Orders  = CALCULATE(SUM('Orders 2'[Net Price]), FILTER('Date Table', 'Date Table'[Date] >= DATE(YEAR(TODAY()), 1, 1)), FILTER('Date Table', 'Date Table'[Date] <= TODAY()))

 

or

YTD Orders = TOTALYTD( [Net Price], 'Date Table'[Date],

DATESBETWEEN('Date Table'[Date],

MIN('Date Table'[Date]), MAX(Date Table'[Date])

))

 

 

Thanks

1 REPLY 1
Adamboer
Responsive Resident
Responsive Resident

Unfortunately, in Power BI, in order to show YTD on a card visual, you need to have a date reference, either through a slicer or a filter. This is because the YTD calculation relies on a date context to determine the period of time to sum up the values for. However, you can use a workaround to achieve the desired result.

One possible workaround is to create a measure that calculates the YTD total for the current year and use it in the card visual. You can create a measure like this:

YTD Orders = CALCULATE(SUM('Orders 2'[Net Price]), FILTER('Date Table', YEAR('Date Table'[Date]) = YEAR(TODAY())), ALL('Date Table'))

This measure calculates the YTD total for the current year by filtering the 'Date Table' to include only the dates in the current year, and then summing up the 'Net Price' column in the 'Orders 2' table. The ALL function is used to remove any existing filters on the 'Date Table' to ensure that the measure returns the correct result regardless of any filters applied to the report.

You can then use this measure in the card visual to show the YTD total without the need for a date reference.

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

July Newsletter

Fabric Community Update - July 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors