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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
WJPHANG
New Member

how to query new items from previous month

 

how do i create a *new measure that indicates the change from previous month for example, a new item or increase/decrease in amount for the month of June versus March?

 

Data available as below:


Date                               Items                   Amount           *new measure

01 March 2016               Apples                10               

01 March 2016              Banana                 20

01  June 2016                Pineapple             5                            New                   

01  June 2016                Banana                 30                         50% 

01 June 2016                 Apples                  8                           -20%

 

Thanks in advance

 

1 ACCEPTED SOLUTION
v-sihou-msft
Microsoft Employee
Microsoft Employee

@WJPHANG

 

In this scenario, you need to get previous date first, then use it to lookup previous amount for your calculation.

 

Please create a calculated column like below:

 

Change Rate = 
var PreviousDate=CALCULATE(MAX(Fruit[Date]),FILTER(Fruit,Fruit[Items]=EARLIER(Fruit[Items]) && Fruit[Date]<EARLIER(Fruit[Date])))
var PreviousAmount=LOOKUPVALUE(Fruit[Amount],Fruit[Date],PreviousDate,Fruit[Items],Fruit[Items])
return 
IF(ISBLANK(PreviousAmount),BLANK(),(PreviousAmount-Fruit[Amount])/PreviousAmount)

4.PNG

 

 

Regards,

View solution in original post

2 REPLIES 2
v-sihou-msft
Microsoft Employee
Microsoft Employee

@WJPHANG

 

In this scenario, you need to get previous date first, then use it to lookup previous amount for your calculation.

 

Please create a calculated column like below:

 

Change Rate = 
var PreviousDate=CALCULATE(MAX(Fruit[Date]),FILTER(Fruit,Fruit[Items]=EARLIER(Fruit[Items]) && Fruit[Date]<EARLIER(Fruit[Date])))
var PreviousAmount=LOOKUPVALUE(Fruit[Amount],Fruit[Date],PreviousDate,Fruit[Items],Fruit[Items])
return 
IF(ISBLANK(PreviousAmount),BLANK(),(PreviousAmount-Fruit[Amount])/PreviousAmount)

4.PNG

 

 

Regards,

cs_skit
Resolver IV
Resolver IV

You need a Rank grouped by item ordered by date then you can reference to that rank -1 to compare with values from last month its almost the same solution as here:

http://community.powerbi.com/t5/Desktop/Last-country-visited-timeline-logic/m-p/206028#M90786

 

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

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.