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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
beepboop
Frequent Visitor

Problem with previous month data visual where date slicer filters by year

I have 3 visuals that compare previous month data. I have a slicer that filters the selected year (2022, 2023, current year (2024)) and this slicer will affect all the visuals on the page. There are currently no page filters. On the visuals, I have set 3 categories for data (previous month visual where it is filtered by relative date - in the last 1 calendar month , current month visual filtered by relative date - in this month, ytd visual that has no filters but i applied a specific measure for the data). The current and ytd visuals are working as expected. However, the previous month visual is not working when we are in January 2024. It is suppose to display December 2023 data but it says 0. On the visual, I am using a measure where a USERELATIONSHIP is being used with the date table. I think I will have to amend this measure but I am certain it has something with how the USERELATIONSHIP function is setup.

 

For context, this is the measure

 

# items by customer = COALESCE(CALCULATE(COUNT(cust_table[Id]),FILTER(cust_table,cust_table[status_new] <> "Already approached" && cust_table[business] = "New"), USERELATIONSHIP(cust_table[date_received], 'date'[date]), USERELATIONSHIP(cust_table[employee], 'User Profile (2)'[Name])),0)
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@beepboop , Make sure the slicer and visual use period from the date table. Try measures like

 

# items by customer = CALCULATE(COUNT(cust_table[Id]),FILTER(cust_table,cust_table[status_new] <> "Already approached" && cust_table[business] = "New"), USERELATIONSHIP(cust_table[date_received], 'date'[date]), USERELATIONSHIP(cust_table[employee], 'User Profile (2)'[Name]))

 

Last month = calculate([# items by customer], dateadd('date'[date],-1, month))


Previous month = calculate([# items by customer], previousmonth('date'[date]))

 

 

Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5b...
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @beepboop ,

 

Did @amitchandak  reply solve your problem? If so, please mark it as the correct solution, and point out if the problem persists.

 

Best Regards,
Adamk Kong

 

 

amitchandak
Super User
Super User

@beepboop , Make sure the slicer and visual use period from the date table. Try measures like

 

# items by customer = CALCULATE(COUNT(cust_table[Id]),FILTER(cust_table,cust_table[status_new] <> "Already approached" && cust_table[business] = "New"), USERELATIONSHIP(cust_table[date_received], 'date'[date]), USERELATIONSHIP(cust_table[employee], 'User Profile (2)'[Name]))

 

Last month = calculate([# items by customer], dateadd('date'[date],-1, month))


Previous month = calculate([# items by customer], previousmonth('date'[date]))

 

 

Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5b...
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

May 2025 Monthly Update

Fabric Community Update - May 2025

Find out what's new and trending in the Fabric community.