cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Tamanna Occasional Visitor
Occasional Visitor

Compare data with previous period and current month

Hi Team,

I am very new to Power BI and want to create report by comparing the data of previous months with the current month. But this report is refreshed every month so I want Power BI to identify what is current month and previous months.

 

So for example :

A of now

previous month : 01/2018

current month : /2018,

however next month

 

Previous Months: 01/2018 + 02/2018

Current month : 03/2018

 

and so on.

 

Based on this I want the count of assets appearing in previous months but missing in current month and vseversa. Is it possible?

1 REPLY 1
mmace1 Member
Member

Re: Compare data with previous period and current month

So this is the way I figured out awhile ago; I'd be curious if there's a smarter way: 

 

This will give the first of last month: 

date(year(today()),month(today())-1,1) 

So right now it would evaluate to January 1st 2018

 

Your row of data must have a column with the date (your Datefield); this would transform that date to the first of the month. 

date(year(YourDateField),month(YourDateField),1)

So if your DateField were September 27 2017, this would evaluate to September 1st 2017. 

 

Then you could set them equal to each other.  As such, TRUE would mean the date was last month, and FALSE would mean it's not. 

date(year(today()),month(today())-1,1) = date(year(YourDateField),month(YourDateField),1) 

 

If you remove the '-1' in the first part, you'd instead be returning if your row was from the current month, '-2' would make it 2 months ago, etc. 

 

Then in your report or measures, you just filter by the TRUE/FALSE column(s) you've created. 

Helpful resources

Announcements
Coming Soon: T-Shirt Design Contest

Coming Soon: T-Shirt Design Contest

Keep your eyes open for our upcoming T-shirt design contest!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors
Top Kudoed Authors