简体   繁体   中英

YTD filtering by category - DAX / Power BI

I have a 'Table' with three columns: Date, Location, Value.

I also have a table 'Tabledates' with a continuous set of dates. Relationships are correctly set.

I have created a measure called YTD with code:

CALCULATE( SUM( Table[Value] ); DATESYTD( Tabledates[Date] ))

On any graph, the YTD measure is perfect, but if I filter by location, the results of YTD are totally wrong.

Any hint?

Picture of results

It seems that the filter on the location is removed when you filter the calendar table.

You can maybe use this function TOTALYTD() https://docs.microsoft.com/en-us/dax/totalytd-function-dax

It does exactly the same and you can try to filter on the date on your first table not on the date of the calendar table.

something like:

TOTALYTD(Sum(Table1[Value]),Table1[Date].[Date])

I think that you have bi-directional filtering or something like that between your table and the calendar table and it remove your previous filter on location.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM