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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
ngocrin1
Frequent Visitor

Create a virtual table with Previous date transaction column

Hi everyone,

I have problem with creating a Virtual table with Previous date transaction column. Has everyone can help me?

The formula to get the Previous date column is below:

 

 formula.png

But the result is still blank.

result.png

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @ngocrin1 
Actually I did not get the idea of using 'Date'[Date] to obtain the previous date. If you want to get pervious calendar date then simply use

Virtual Table =
ADDCOLUMNS (
    SUMMARIZE ( Sales, Sales[Purchase Date], Sales[Sales Person ID] ),
    "@Revenue", [Sales Revenue],
    "@PreDate", Sales[Purchase Date] - 1
)

If you're looking for the previous sales date of the product in row then please try

Virtual Table =
ADDCOLUMNS (
    SUMMARIZE ( Sales, Sales[Purchase Date], Sales[Sales Person ID] ),
    "@Revenue", [Sales Revenue],
    "@PreDate",
        VAR CurrentDate = Sales[Purchase Date]
        VAR PreDate =
            MAXX (
                CALCULATETABLE (
                    VALUES ( Sales[Purchase Date] ),
                    Sales[Purchase Date] < CurrentDate
                ),
                Sales[Purchase Date]
            )
        RETURN
            PreDate
)

View solution in original post

3 REPLIES 3
tamerj1
Super User
Super User

Hi @ngocrin1 
Actually I did not get the idea of using 'Date'[Date] to obtain the previous date. If you want to get pervious calendar date then simply use

Virtual Table =
ADDCOLUMNS (
    SUMMARIZE ( Sales, Sales[Purchase Date], Sales[Sales Person ID] ),
    "@Revenue", [Sales Revenue],
    "@PreDate", Sales[Purchase Date] - 1
)

If you're looking for the previous sales date of the product in row then please try

Virtual Table =
ADDCOLUMNS (
    SUMMARIZE ( Sales, Sales[Purchase Date], Sales[Sales Person ID] ),
    "@Revenue", [Sales Revenue],
    "@PreDate",
        VAR CurrentDate = Sales[Purchase Date]
        VAR PreDate =
            MAXX (
                CALCULATETABLE (
                    VALUES ( Sales[Purchase Date] ),
                    Sales[Purchase Date] < CurrentDate
                ),
                Sales[Purchase Date]
            )
        RETURN
            PreDate
)

Tks Tamerj1,

It worked well. I'm looking for previous date sales transactions.

some_bih
Super User
Super User

Hi @ngocrin1 please try to change your date column in Power Query from type date time to type date, and see results. I hope this help





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.