sql-bi / Bravo

Bravo for Power BI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MTD, YTD, etc logic problem / question

mattsmac opened this issue · comments

Hello, it seems like the logic for doing any of the time based calculations for MTD, QTD, or YTD, relay on a hidden measure called "_ShowValuesForDates". That makes sense in order to limit the dates that are using the in the formulas. However, it seems like the logic for that hidden measure is flawed, or at least I don't understand the correct way to use it. It seems that it always returns true, no matter what the date, since the "__FirstDateVisible" is always less than the last date with data. I was able to work around this by adding another calculated column to the dates table that only returns true if that row's date is less than the max date in my data table and then adding that column as a filter on my page, but it seems like that should be built into the generated dates table somehow. If there is another way I should be using this, please let me know.

The measure _ShowValuesForDates is created dynamically based on the Date columns selected in Bravo to generate the Date table. If you set a fixed range of years, that probably doesn't work automatically, and you should adjust that manually. Can you provide the _ShowValuesForDates definition you have in the model so we can validate whether this is your case?

Here is the code. SubmittalBatch is my table and SubmittalDate is the date column I selected when generating the dates table.

_ShowValueForDates = VAR __LastDateWithData = CALCULATE ( MAXX ( { MAX ( 'SubmittalBatch'[SubmittalDate] ) }, ''[Value] ), REMOVEFILTERS () ) VAR __FirstDateVisible = MIN ( 'Date'[Date] ) VAR __Result = __FirstDateVisible <= __LastDateWithData RETURN __Result