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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
gdexter
Frequent Visitor

Comparing selected month automatically with previous month

Hi Power BI community,

 

I need your help!

 

Would like to select a date range using slicer and then have a two tables below. One which shows data for the selected month, and one which dynamically adjusts to show data from month before the selected time.

 

Below is an image of what I am trying to achieve.dynamic 1 month offset.PNG

 

EXTRA INFO:

Will briefly describe what I have tried to do so far.

I have created a new date column that has all the dates offset backwards by one month in relation to my original date column. I assumed I could then add the "daily-1month" data to the visual labelled two months ago. I tried, shown below and nothing changed.

AB1.png

 

Here is the DATA view for date columns

AB2.PNG

 

Yours,

Gdexter

1 ACCEPTED SOLUTION
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @gdexter,

 

Based on my understand for your requirement, I made a test.

 

You could create two measures like below.

 

current date = CALCULATE(SUM('table'[Sales]))

last month = CALCULATE(SUM('table'[Sales]),DATEADD('table'[Date],-1,MONTH))

So that you could get the output below.

 

Capture.PNG

For more details, you could have a reference of this attachment.

 

If you still need help, please share some data sample witch could reproduce your scenario, so that we can help further investigate on it?

 

Best  Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @gdexter,

 

Based on my understand for your requirement, I made a test.

 

You could create two measures like below.

 

current date = CALCULATE(SUM('table'[Sales]))

last month = CALCULATE(SUM('table'[Sales]),DATEADD('table'[Date],-1,MONTH))

So that you could get the output below.

 

Capture.PNG

For more details, you could have a reference of this attachment.

 

If you still need help, please share some data sample witch could reproduce your scenario, so that we can help further investigate on it?

 

Best  Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Cherry,

 

Thanks for the advice and apologies for my lateness in getting back to you.

 

The pie chart I attached above is calculated by measuring the number of occurences of the word "EARLY", "LATE" and "ONTIME". These are non-numerical values, so I used COUNT in the place of where you used SUM. 

 

Then it worked fine, thanks very much!

 

Best,

Gdextor

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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