Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
Syndicate_Admin
Administrator
Administrator

Time filter help

Hello Community,

For several days I have been dealing with a filter. I have a small calendar table, where I also have a column "Relative_cod" that goes from number 1 to 24, with 1 being the number of the most current month and 24 the oldest.

Now, I create a measure for my QTR (in Tableau) more or less like that (with the 24 months)

QTR = IF([RELATIVE_CODE] >= 1 && [RELATIVE_CODE]<= 4, [MTH],
IF([RELATIVE_CODE] >= 4 && [RELATIVE_CODE] < 7, DATEADD(Period[DATE],-21,MONTH),
IF([RELATIVE_CODE]>=7 && [RELATIVE_CODE]<10, DATEADD(Period[DATE],-18,MONTH)
With that measure, by filtering by 'QTR' I can see my charts like this.ej community.png

How could I achieve the same in Power bi? I have already created a measure and a table, pass my measure to the table

Medida_FILTRO = IF(HASONEFILTER(FILTER[Measure]),
SWITCH(
VALUES(FILTER[ID_medida]),
1,[QTR])))
But as I said before, I can't see QTR like in Tableau. I hope you can help me
2 REPLIES 2
Syndicate_Admin
Administrator
Administrator

Thank you for your reply, but I still don't achieve the result I expect. Using DATEADD I only move the months but I do not bring the total accumulated of the quarter

lbendlin
Super User
Super User

QTR = SWITCH(TRUE(),[RELATIVE_CODE]<= 4, [MTH],
[RELATIVE_CODE] < 7, DATEADD(Period[DATE],-21,MONTH),
[RELATIVE_CODE]<10, DATEADD(Period[DATE],-18,MONTH),
<some value for "else">)

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.