Forum Discussion
Select Latest ID From Slow Changing Dimension Table Based On Date Slicer
- 2 years ago
Hi all ,
Anonymous , thanks for your concern about this case, I have some additions for problem solving.
alee5210 , thank you for giving a specific description of the problem. Based on your imformation, I will give you the following steps to solve the problem.
1.The test table Data table, Date table, EffectiveDate.
2.The test model.
3.New Measure FILTER, and input:
FILTER = VAR _select = SELECTEDVALUE(EffectiveDate[Date]) VAR _End = CALCULATE( MAX('Data table'[Effective End Date]), ALLEXCEPT('Data table', 'Data table'[Test ID]), 'Data table'[Effective Start Date] <= _select ) RETURN IF( MAX('Data table'[Effective Start Date]) <= _select && MAX('Data table'[Effective End Date]) = _End, 1, 0 )4.Add Date to Field.
5.Add FILTER to Filters on this visual.
6.The outcome is in the following pictures.
If they select the user selects 2 Jan, 2024
If they select 16 Jan, 2024
If they select 31 Jan, 2024
All above contents can answer your original questions. For your latest questions, it probably due to the relationship you have between the Data table and the Date table. When the relationship looks like this picture, the same result will appear as you.
Best Regards,
Caroline Mei
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
The solution i'd use is to have 2 different Calendar tables. The main table is the one that acts as your model's calendar table and is connected to your fact table using the "Date Submitted" field.
The 2nd calendar table would be purely a disconnected table used to select "As At", to allow your users to change where in time they want a result for.
From here you could get the a sum of all the right masses by doing:
Base Measure:
Mass Sum = SUM('Data Table'[Mass])Date Constrainted output:
Current Mass = var selectedDate = MAX('Date Selection'[Date])
var output = CALCULATE(
[Mass Sum],
'Data Table'[Effective Start Date] <= selectedDate,
'Data Table'[Effective End Date] >= selectedDate,
)
RETURN
output
(note, i've used MAX rather than SELECTEDVALUE to increase the robustness of where this could be used)
- alee52102 years ago
Helper II
Do you think that it is possible with just a single date table?
- Anonymous2 years agoNot applicable
No. Your normal date table needs to be configured to handle the filter context of how dates relate to your data, in the manner as if you didn't store the history. The 2nd date table is required to handle the filter context on what is considered "now".
The reason is because you have 2 dimensions of data and overlaying a 3rd separate dimension, which is your 'where in the 2 dimensions do you want to see'.
- alee52102 years ago
Helper II
This is a bit of a pain as I've also added some additional fields to my date table so it looks like the below.
Date Reporting Week Data Period 01/01/2024 01/01/2024 02/01/2024 01/01/2024 03/01/2024 01/01/2024 04/01/2024 01/01/2024 05/01/2024 01/01/2024 06/01/2024 01/01/2024 07/01/2024 01/01/2024 08/01/2024 08/01/2024 09/01/2024 08/01/2024 10/01/2024 08/01/2024 11/01/2024 08/01/2024 12/01/2024 08/01/2024 13/01/2024 08/01/2024 14/01/2024 08/01/2024 15/01/2024 15/01/2024 16/01/2024 15/01/2024 17/01/2024 15/01/2024 18/01/2024 15/01/2024 Last 2 Weeks 19/01/2024 15/01/2024 Last 2 Weeks 20/01/2024 15/01/2024 Last 2 Weeks 21/01/2024 15/01/2024 Last 2 Weeks 22/01/2024 22/01/2024 Last 2 Weeks 23/01/2024 22/01/2024 Last 2 Weeks 24/01/2024 22/01/2024 Last 2 Weeks 25/01/2024 22/01/2024 Last 2 Weeks 26/01/2024 22/01/2024 Last 2 Weeks 27/01/2024 22/01/2024 Last 2 Weeks 28/01/2024 22/01/2024 Last 2 Weeks 29/01/2024 29/01/2024 Last 2 Weeks 30/01/2024 29/01/2024 Last 2 Weeks 31/01/2024 29/01/2024 Last 2 Weeks I use the reporting week and the data period field in my dashboard. I noticed that when I use the 2 tables together, the dashboard begins to function in an unusual way and does not give predictable reults.
If I try your method of the disconnected table it is working well.
But the moment I bring in the first connected table, things get a bit weird. I'm no longer getting the same results as I would have expected. Is there anyway that I can ammend this? This is driving me crazy!