Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

How to compare values for two specific dates

I want to compare values between last date and second last date. The date table has future dates as well so I am filtering the date with the non null FactCovidADCDaily[Daily Census (Total)] value. Here is my DAX:


Second Last Date =
MAX ( DimDate[Date] ),
FILTER ( DimDate, 'DimDate'[Date] <> MAX ( DimDate[Date] )),
FILTER(FactCovidADCDaily, FactCovidADCDaily[Daily Census (Total)] <> BLANK() ))
Last Date =
MAX ( DimDate[Date] ),
FILTER(FactCovidADCDaily, FactCovidADCDaily[Daily Census (Total)] <> BLANK() ))
Problem 1 : I don't know why but both "Last Date" and "Second Last Date" is displaying the same result. Am I doing anything wrong?
Problem 2 : Can you please provide me a DAX for -
                    If FactCovidADCDaily[Daily Census (Total)] on Second Last Date > Last Date then 1 else 0
Super User III
Super User III

Hi @monikamishra ,


On the second last date you are picking up all the dates except the max date however since you are getting the full values of the table you always get the same values.


I don't know how you have your information but  the second last date can be picked up with something similar to:

Second Last Date = 
    FILTER (
        FactCovidADCDaily[Daily Census (Total)] <> BLANK ()
            && FactCovidADCDAily[Date] < MAX ( DimDate[Date] )





Miguel Félix

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

Proud to be a Super User!

Check out my blog:

Power BI em Português

Helpful resources



We are excited to announce the Power BI Super Users!

Microsoft Ignite

Microsoft Ignite with Arun Ulag

Featured Session: Drive Data Culture with Power BI- Vision, Strategy & Roadmap. Register here #MSIgnite #PowerPlatform #Power BI ​

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!


The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors