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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
Daplis
Regular Visitor

Getting Sales of Previous Period with Multiple filters

Hello! Can't seem to get the correct value for sales of previous period when multiple sliders are involved. Already tried multiple solutions but I can't figure out what's missing. All the data are placed in a single table already to simplify the visualization. 

 

DeptSalesByType Table columns:

Sales (Fixed Decimal Number)

Department (Text)

Transaction_date (Whole Number)

Type (Text)

FullDate (converted Date/Time from Transaction_Date)

 

4 Sliders:

Year (2017 | 2018 | 2019 | 2020)

Month (Jan | Feb | Mar | .... Nov | Dec)

Type ( All | Loyalty | Non-Loyalty)

Department (Cosmetics | Kids | Mens | Womens)

 

Measures:

Sales Previous Period = CALCULATE(SUM(DeptSalesByType[ Sales ]),DATESBETWEEN(DeptSalesByType[FullDate],[Start Previous Period],[End Previous Period]))  -- always Blank result
 
Sales Previous Year v2 = CALCULATE(SUM(DeptSalesByType[ Sales ]),
FILTER
(ALL(DeptSalesByType[FullDate]),DATESBETWEEN(DeptSalesByType[FullDate],[Start Previous Period],[End Previous Period])
)--  same result as the sales of current Period

 

Sales Current Period = CALCULATE(SUM(DeptSalesByType[ Sales ]),DATESBETWEEN(DeptSalesByType[FullDate],[Start Current Period],[End Current Period]))  --  Working
 
Daplis_0-1619176245608.png

 

 
1 ACCEPTED SOLUTION
Daplis
Regular Visitor

Actually managed to solve this. Had to create a duplicate table of the FullDate and it worked. Not sure if it's the right way though as I made the date redudant.

View solution in original post

4 REPLIES 4
Daplis
Regular Visitor

Actually managed to solve this. Had to create a duplicate table of the FullDate and it worked. Not sure if it's the right way though as I made the date redudant.

Anonymous
Not applicable

@Daplis 

 

You only a Full Date column, I don't see how did you get the Start and End period, can you just share sample pbix.

 

Paul Zheng _ Community Support Team

Hi,

Here they are:

Start Current Period = FIRSTDATE(DeptSalesByType[FullDate])
End Current Period = LASTDATE(DeptSalesByType[FullDate])
 
Start Previous Period = [End Previous Period]-[Days Current Period]
End Previous Period = [Start Current Period]-1
 
Days Current Period = DATEDIFF([Start Current Period],[End Current Period],day)

Anonymous
Not applicable

@Daplis 

 

This is a question about DAX, not Power Query... Can you please post this on the right forum?

 

A very quick hint why this does not work can be found at

Understand star schema and the importance for Power BI - Power BI | Microsoft Docs

and

Time Intelligence in Power BI Desktop - SQLBI.

Helpful resources

Announcements
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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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