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

% Difference between two date value

Capture.PNG

 

How to get % Change between current Week and Previous Week?
Any solution ?

2 ACCEPTED SOLUTIONS

@sewaktamang

 

It gives me correct values

 

1019.png

 

 

Did you try this formula

 

Column =
VAR Priorday =
    CALCULATE (
        MAX ( TableName[Week] ),
        FILTER ( ALL ( TableName ), TableName[Week] < EARLIER ( TableName[Week] ) )
    )
RETURN
    DIVIDE (
        TableName[Conversions],
        CALCULATE (
            SUM ( TableName[Conversions] ),
            FILTER ( TableName, TableName[Week] = Priorday )
        )
    )
        - 1

 


Regards
Zubair

Please try my custom visuals

View solution in original post

@sewaktamang

 

Could you show me the screenshot of your formula?


Regards
Zubair

Please try my custom visuals

View solution in original post

10 REPLIES 10
Zubair_Muhammad
Community Champion
Community Champion

@sewaktamang

 

If your Weeks are simple dates with 7 days gap then this calculated column should work

 

Colum =
VAR Priorday =
    PREVIOUSDAY ( TableName[Week] )
RETURN
    DIVIDE (
        TableName[Conversions],
        CALCULATE (
            SUM ( TableName[Conversions] ),
            FILTER ( TableName, TableName[Week] = Priorday )
        )
    )
        - 1

Regards
Zubair

Please try my custom visuals

Capture.PNG 

 

It gives -100% @Zubair_Muhammad

Hi @sewaktamang

 

Please try with this minor modification (HIghlighted in RED below)

 

Colum =
VAR Priorday =
    PREVIOUSDAY ( TableName[Week] )
RETURN
    DIVIDE (
        TableName[Conversions],
        CALCULATE (
            SUM ( TableName[Conversions] ),
            FILTER ( ALL ( TableName ), TableName[Week] = Priorday )
        )
    )
        - 1

Regards
Zubair

Please try my custom visuals

PREVIOUSDAY ( TableName[Week] )

THis is giving Empty Column  

@sewaktamang

 

my mistake. PreviousDays do not exist since there are gaps in dates

 

Please use the revised formula. I provided above. It shall work hopefully


Regards
Zubair

Please try my custom visuals

It is giving me date value 😞

 

Column

Friday, 29 December 1899
Saturday, 30 December 1899
Saturday, 30 December 1899
Saturday, 30 December 1899
Saturday, 30 December 1899

@sewaktamang

 

It gives me correct values

 

1019.png

 

 

Did you try this formula

 

Column =
VAR Priorday =
    CALCULATE (
        MAX ( TableName[Week] ),
        FILTER ( ALL ( TableName ), TableName[Week] < EARLIER ( TableName[Week] ) )
    )
RETURN
    DIVIDE (
        TableName[Conversions],
        CALCULATE (
            SUM ( TableName[Conversions] ),
            FILTER ( TableName, TableName[Week] = Priorday )
        )
    )
        - 1

 


Regards
Zubair

Please try my custom visuals

@sewaktamang

 

Could you show me the screenshot of your formula?


Regards
Zubair

Please try my custom visuals

@sewaktamang

 

A small improvement to this formula so that you do not get -100% for firstweek/firstdate

HIghlighted in RED font below

 

Column =
VAR Priorday =
    CALCULATE (
        MAX ( TableName[Week] ),
        FILTER ( ALL ( TableName ), TableName[Week] < EARLIER ( TableName[Week] ) )
    )
RETURN
    IF (
        NOT ( ISBLANK ( Priorday ) ),
        DIVIDE (
            TableName[Conversions],
            CALCULATE (
                SUM ( TableName[Conversions] ),
                FILTER ( TableName, TableName[Week] = Priorday )
            )
        )
            - 1
    )

 

 


Regards
Zubair

Please try my custom visuals

Hi @sewaktamang

 

My apologies.

 

Please use this formula

 

This will get you correct results

 

Column =
VAR Priorday =
    CALCULATE (
        MAX ( TableName[Week] ),
        FILTER ( ALL ( TableName ), TableName[Week] < EARLIER ( TableName[Week] ) )
    )
RETURN
    DIVIDE (
        TableName[Conversions],
        CALCULATE (
            SUM ( TableName[Conversions] ),
            FILTER ( TableName, TableName[Week] = Priorday )
        )
    )
        - 1

Regards
Zubair

Please try my custom visuals

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.