March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello everyone,
Please assist. I want to present a chart that will auto-filter the last four quarters regardless of the year e.g., FY21 Q4, FY22 Q1, FY22 Q2, and FY22 Q3. I have attached the sample file below. NOTE: Quarter One starts on October
Here is the file: Power BI File
Solved! Go to Solution.
Create a measure that returns quarter difference with your max date in fact table.
use below measure in the visual filters to display number of quarters you want.
QuartersDiff = var maximum = CALCULATE(MAX(testing[boardapprovaldate]),ALL('testing'))
RETURN
DATEDIFF(MAX(testing[boardapprovaldate]),maximum,QUARTER)
Hi @tmhalila
When you say last four quarters, is that based on the latest quarter in testing table or based on a slicer selection? If it is based on the slicer selection, you must use a disconnected dates table - one which doesn't have relationship to dates or testing table. Otherwise, your visual show just whatever is selected from the slicer.
First, sort your quarters first by ranking
Quarter Sort =
RANKX (
VALUES ( 'dim date'[fiscalquarter&year] ),
'dim date'[fiscalquarter&year],
,
ASC,
Dense
)
Create a disconnected table (more than one ways to do it but you can reference your dates table)
dim date (disconnected) =
'dim date'
Create a measure that will show just the last four quarters based on slicer selection
Count new =
VAR currentquartersort =
SELECTEDVALUE ( 'dim date (disconnected)'[Quarter Sort] )
RETURN
CALCULATE (
[No of Project],
FILTER (
'dim date',
'dim date'[Quarter Sort] >= currentquartersort - 3
&& 'dim date'[Quarter Sort] <= currentquartersort
)
)
Replace the column used in quarter slicer with the one from the disconnected dates table.
Please see attached pbix for details.
Proud to be a Super User!
Hi @tmhalila
When you say last four quarters, is that based on the latest quarter in testing table or based on a slicer selection? If it is based on the slicer selection, you must use a disconnected dates table - one which doesn't have relationship to dates or testing table. Otherwise, your visual show just whatever is selected from the slicer.
First, sort your quarters first by ranking
Quarter Sort =
RANKX (
VALUES ( 'dim date'[fiscalquarter&year] ),
'dim date'[fiscalquarter&year],
,
ASC,
Dense
)
Create a disconnected table (more than one ways to do it but you can reference your dates table)
dim date (disconnected) =
'dim date'
Create a measure that will show just the last four quarters based on slicer selection
Count new =
VAR currentquartersort =
SELECTEDVALUE ( 'dim date (disconnected)'[Quarter Sort] )
RETURN
CALCULATE (
[No of Project],
FILTER (
'dim date',
'dim date'[Quarter Sort] >= currentquartersort - 3
&& 'dim date'[Quarter Sort] <= currentquartersort
)
)
Replace the column used in quarter slicer with the one from the disconnected dates table.
Please see attached pbix for details.
Proud to be a Super User!
This is something incredible, I didn't think of it, but I see this is the best way to handle selection on the slicer. It adds more flexibility with multiple visuals.
Create a measure that returns quarter difference with your max date in fact table.
use below measure in the visual filters to display number of quarters you want.
QuartersDiff = var maximum = CALCULATE(MAX(testing[boardapprovaldate]),ALL('testing'))
RETURN
DATEDIFF(MAX(testing[boardapprovaldate]),maximum,QUARTER)
Thanks for the response! This is short and clear.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
89 | |
84 | |
70 | |
51 |
User | Count |
---|---|
206 | |
143 | |
97 | |
79 | |
68 |