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
aganes
Frequent Visitor

Cannot show paid total from yesterday using PREVIOUSDAY()

Hi PBI Community,

 

I'm trying to build a dashboard where the user can input a date, and it will show them comparative metrics:

 

  • This year vs. Previous Year
  • This Quarter vs. Previous Quarter
  • This Month vs. Previous Month
  • This Day vs. Previous Day

The Previous Day view has been giving me difficulty. I've structured my query as follows:

 

PaidTotalIssue.PNG

 

...but for some reason, 'PaidTotalYesterday' shows the same as the today value. This is especially confusing because I was able to get metrics for last year/quarter/month using a similarly structured query, however it is not working when I apply this to the day. 

 

I am also able to get a working 'Yesterday' column via PREVIOUSDAY('Dates'[Day]) but cannot apply this to the 'PaidTotalYesterday' column.

 

Any help would be greatly appreciated!!!!

 

Some other info:

  • 'PaidTotalDay' is SUM('Transactions'[paidTotal]) ----- The sum of all line items
  • I've linked my transaction table to a calendar table called 'Dates' that includes every day that we have received a transaction.
1 ACCEPTED SOLUTION
v-cherch-msft
Employee
Employee

Hi @aganes 

Based on my attached sample file,it seems correct.Could you share more details about your scenario?You may also try the second measure for your data.

PaidTotalYesterday2 =
CALCULATE (
    [PaidTotalDay],
    FILTER ( ALL ( Dates ), Dates[Date] = MAX ( Dates[Date] ) - 1 )
)

1.png

Regards,

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-cherch-msft
Employee
Employee

Hi @aganes 

Based on my attached sample file,it seems correct.Could you share more details about your scenario?You may also try the second measure for your data.

PaidTotalYesterday2 =
CALCULATE (
    [PaidTotalDay],
    FILTER ( ALL ( Dates ), Dates[Date] = MAX ( Dates[Date] ) - 1 )
)

1.png

Regards,

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you so much @v-cherch-msft! Your FILTER suggestion worked perfectly. Weird it didn't work with PREVIOUSDAY... that must have something to do with the way my calendar table is derived.

 

Much appreciated!

Alex

 

 

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.