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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
arielfmdp
Frequent Visitor

issue in day to day variance % with non consecutive dates

Hi team, I'm having a headache with this problem, I need to calculate a column with variance in percentage to previous date, BUT with non consecutive dates.

I'm getting this using

 

Var%PreviousDate =

((SUM('cnv rends-patrim-varcp'[CantCPActual]) /

  CALCULATE(

     SUM('cnv rends-patrim-varcp'[CantCPActual]);

     PREVIOUSDAY('cnv rends-patrim-varcp'[fecha])

))-1)*100

 

For example, the previous date for 19/03-16/03 doesn't work because the formula is using 18/03 instead of 16/03.

 

I should be able to get the spreadsheet aproach, look:pwoer bi issue date to date variance.png

 

 

 

 Well, that's all, I hope someone can help, I didn't find this issue on the forums.

Regards,

Ariel

1 ACCEPTED SOLUTION

@arielfmdp

 

Hi try wiyh:

 

Var%PreviousDate =
VAR fdate =
    SELECTEDVALUE ( Tabla1[Date] )
VAR ff =
    CALCULATE ( MAX ( Tabla1[Date] ); Tabla1[Date] < fdate )
RETURN
    (
        (
            SUM ( Tabla1[CantCPActual] )
                / CALCULATE (
                    SUM ( Tabla1[CantCPActual] );
                    FILTER ( ALL ( Tabla1 ); Tabla1[Date] = ff )
                )
                - 1
        )
            * 100
    )

Regards

Victor

Lima - Peru




Lima - Peru

View solution in original post

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi,

 

Share the link from where i can download your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Sorry, I'm new Man Embarassed  here is the link to the test pbix

https://drive.google.com/open?id=1SpXqIgStbgwuvwLRhloCw_30aJ7_qww8

@arielfmdp

 

Hi try wiyh:

 

Var%PreviousDate =
VAR fdate =
    SELECTEDVALUE ( Tabla1[Date] )
VAR ff =
    CALCULATE ( MAX ( Tabla1[Date] ); Tabla1[Date] < fdate )
RETURN
    (
        (
            SUM ( Tabla1[CantCPActual] )
                / CALCULATE (
                    SUM ( Tabla1[CantCPActual] );
                    FILTER ( ALL ( Tabla1 ); Tabla1[Date] = ff )
                )
                - 1
        )
            * 100
    )

Regards

Victor

Lima - Peru




Lima - Peru

Thank you very much @Vvelarde, it worked perfectly!

I'm still have a lot to learn about DAX.

Greg_Deckler
Community Champion
Community Champion

To get the previous day, you want to find the MAX of all dates that are less than the current date. Tough to be more specific without data pasted in a way that can be copied and pasted easily (non-image). But, these two links might help, see what I do with MTBF in this article:

 

See my article on Mean Time Before Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395...

 

Also, see this article:

 

Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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.

Top Solution Authors