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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
userdata
Helper IV
Helper IV

Previous Month without any date filter

Hi,

 

i have a table like this 

id name country  month year       sales

2  dfd     zy              2        2020    10

 

What I need to calculate is month and previous month based on selected month and year and the same where I have to calculate which quarter is selected and get previous quarter. 

The issue is that I have no date, so I cant use any time intelligence functions either my measure overwrites all the other columns.

How can I calculate previous month or quarter based on the slicer if there is no date table ?

 

3 REPLIES 3
userdata
Helper IV
Helper IV

I tried sth like SUM ( table[sales] ),
, FILTER ( ALL('table'),'table'[QuarterYear]= MAX('table'[QuarterYear]) - 1 but this doesnt give the right values for previous quarter sales, but not sure why
VahidDM
Super User
Super User

Hi @userdata 

 

It would be better if you add date table to your report. Can you add more details about the result you are looking for.

 

Try this if you just want to find the Last month number:

Last Month = 
Var _Date =
selectedvalue(table[month])-1

and to find the quarter you can use QUARTER dax code, something like this:

 

Quarter=
Var _D = date(selectedvalue(table[year]),selectedvalue(table[month]),01)
return
QUARTER(_D)

 

Previous Quarter=
Var _D = date(selectedvalue(table[year]),selectedvalue(table[month]),01)

Var _3D = DATEADD(_D,-3,month)

return
QUARTER(_3D)

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos!!

 

Hi, im not sure I can fully follow. The problem is that i cant use dateadd as I dont have any date in my table at all. I tried using previous quarter but this says the var _d is not the right one. 

What i want is the sum(sales) of the quarter that is selected in the slicer (which is quarter and year) and show previous quarter sales next to it based on which quarter and year is selected. The same for month, if a month and year are selected, to show sum(sales) of that and next to it previous month based on the selection filter

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors