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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
TheHans
Helper I
Helper I

Get previous date values

Hi Guys,

I have a table that contains a report date and  values for that date. The dates are unique in the table.

In the visual I would like to highlight the differences of Amount 1 (Report date-Prev. Report Date) and Amount 2 (Report date-Prev. Report Date) .

I was successful in determining the previous report date, however, I can't determin the previous amounts (or at least the difference)

Actually the difference would also work.

 

Table1:

Report DateAmount1Amount2Prev. Report DatePrev. Amount1Prev. Amount2
17.03.20215015415.03.202124148
15.03.20212414814.03.202118523
14.03.20211852320.02.202133885
20.02.202133885   

Any idea how I can add this information to my table using DAX? Or a Measure?

Thanks in advance.

1 ACCEPTED SOLUTION
stevedep
Memorable Member
Memorable Member

Hi,

pls see below:

PrevAmount = 
VAR _selDate = SELECTEDVALUE(DimDate[Date])
VAR _maxDate = CALCULATE(LASTNONBLANK(DimDate[Date], CALCULATE(SUM('Table'[Amount1]))), FILTER(ALLSELECTED(DimDate), [Date] < _selDate))
RETURN
IF(NOT(ISBLANK(SUM('Table'[Amount1]))),
CALCULATE(SUM('Table'[Amount1]), FILTER(ALLSELECTED(DimDate),DimDate[Date] = _maxDate)), BLANK())

stevedep_0-1616157648551.png

Kind regards, Steve. 

View solution in original post

4 REPLIES 4
stevedep
Memorable Member
Memorable Member

Hi,

pls see below:

PrevAmount = 
VAR _selDate = SELECTEDVALUE(DimDate[Date])
VAR _maxDate = CALCULATE(LASTNONBLANK(DimDate[Date], CALCULATE(SUM('Table'[Amount1]))), FILTER(ALLSELECTED(DimDate), [Date] < _selDate))
RETURN
IF(NOT(ISBLANK(SUM('Table'[Amount1]))),
CALCULATE(SUM('Table'[Amount1]), FILTER(ALLSELECTED(DimDate),DimDate[Date] = _maxDate)), BLANK())

stevedep_0-1616157648551.png

Kind regards, Steve. 

Hey Steve,

thanks a lot. Appreciate your support.

Hans

amitchandak
Super User
Super User

@TheHans , Try a measure like

 

calculate(sum(Table[Amount1]), filter(allselected(Table), Table[Date] =calculate(max(Table[Date]),filter(allselected(table), [Date] <max([Date])))))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi Amit,

thanks for the quick reply. I get as a result 24 for every row.

 

Is there a way to add new columns as in my example "Prev. Amount1" and "Prev. Amount1" which is calculated out of the existing data in the table?

 

Basically the result of this should look like in the sample table above.

Hans

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Users online (4,911)