Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MTD, YTD, etc logic problem / question #575

Open
mattsmac opened this issue Jan 17, 2023 · 2 comments
Open

MTD, YTD, etc logic problem / question #575

mattsmac opened this issue Jan 17, 2023 · 2 comments
Labels
area-ManageDates awaiting reply More information is needed

Comments

@mattsmac
Copy link

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.

@albertospelta albertospelta added area-ManageDates untriaged A new issue requiring triage labels Jan 17, 2023
@marcosqlbi
Copy link
Collaborator

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?

@marcosqlbi marcosqlbi added awaiting reply More information is needed and removed untriaged A new issue requiring triage labels Jan 17, 2023
@mattsmac
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-ManageDates awaiting reply More information is needed
Projects
None yet
Development

No branches or pull requests

3 participants