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
Tamanna
New Member

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
Impactful Individual
Impactful Individual

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