Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi everybody,
I have been trying to solve this issue on my own for a while and I am stuck.
So I would like to ask for your support.
I have a dashboard where the users can select the time frame at the top with a slicer.
The visualisations in the upper part of the dashboard reflect the data for the selected time frame (always 3 months).
My issue is for the visualisations in the lower part of the dashboard which should reflect data for the selected quarter and the previous 4 as shown below as an example:
In my data model I have the following:
- Date Table
- Measure Table (linked to Date Table on date) with measures and categories
- Independant Date Table
I did some research on this forum and have already created an additional independant date table for the slicer.
I tried several formulas but none of them worked. I would need something that gives me the previous 4 quarters (or 12 months) from the min date selected in the slicer.
Any input would be very appreciated.
Many thanks in advance!
Hi @Gattinomio,
I need one clarity from your end please confirm. you want last 12 month (4 Qtr) from min selected date or max selected date?
Regards,
AjithKumar
Hi, @Gattinomio
You can try the following measure. If you want to achieve this effect, the relationship between the Date table and the Measure table cannot be activated, if you want to use this slicer to achieve the effect of filtering other visuals, you can use the Related, userrelationship function to activate the relationship.
previous 4 quarters flag =
VAR _startDate =
CALCULATE ( MIN ( 'Date'[Date] ) )
VAR _endDate =
CALCULATE ( MAX ( 'Date'[Date] ) )
VAR _date_diff = _endDate - _startDate
VAR _ture_endDate = _startDate + 365
VAR _re =
IF (
_date_diff <= 365,
IF (
SELECTEDVALUE ( 'Measure'[Date] ) >= _startDate
&& SELECTEDVALUE ( 'Measure'[Date] ) <= _endDate,
1,
0
),
IF ( SELECTEDVALUE ( 'Measure'[Date] ) > _ture_endDate, 0, 1 )
)
RETURN
_re
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Dear Yang,
many thanks again for your help.
I wasn't able to use the measure exactly as you wrote it but thanks to your suggestion I tweaked it to write two new measures:
To filter the data for the past 4 quarters
Hi, @Gattinomio
Have you currently resolved this problem, if not, you can share the pbix file without sensitive data for testing, or show your current progress as a picture. From your description, it looks like what you want to do is create a quarterly slicer that filters the first four quarters of data based on the quarterly slicer selection.
Best Regards,
Yang
Community Support Team
Dear Yang,
many thanks for having taken the time to work on a solution for me and to have answered.
I'm currently traveling and I was not able to look at the solution you suggested in details yet. I will do so by the end of the week.
Many thanks again and have a nice day!
User | Count |
---|---|
84 | |
80 | |
70 | |
47 | |
43 |
User | Count |
---|---|
108 | |
54 | |
50 | |
40 | |
40 |