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

Compare same and different dates from one data source

Hello people, I am new to the Bi and the community. 

 

I have a question that I could not find the exact same in other posts. I want to compare from one data source different and same dates, for example I want to compare 2 retailers on the same dates, or one retailer in two periods of time. Any ideas?

 

Capture.PNG

3 REPLIES 3
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @gpapasara,

 

I have made test with creating two measures as your requirement.

 

Difference for the same retailer =
IF (
    ISFILTERED ( 'Table'[Retailer] ),
    CALCULATE (
        SUM ( 'Table'[Sales] ),
        FILTER ( 'Table', 'Table'[Date] = MAX ( 'Table'[Date] ) )
    )
        - CALCULATE ( SUM ( 'Table'[Sales] ), DATEADD ( 'Table'[Date], -1, DAY ) ),
    BLANK ()
)
difference for the same date =
IF (
    ISFILTERED ( 'Table'[Date] ),
    CALCULATE (
        SUM ( 'Table'[Sales] ),
        FILTER ( 'Table', 'Table'[Retailer] = "B" )
    )
        - CALCULATE (
            SUM ( 'Table'[Sales] ),
            FILTER ( 'Table', 'Table'[Retailer] = "A" )
        ),
    BLANK ()
)

Here is the output.

 

difference.png

 

More details you could refer to the attachment.

 

If you need additional help, please share some data sample and your desired output.

 

Best Regards,

Cherry

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

Hi, thank you for replying,

 

Please find below a sample of my data:

Capture2.PNG

 

 

 

What I would like to have at the end of this is something like that:

Capture.PNG

 

Thank you again for the help.

 

 

Hi @gpapasara,

 

You could have a reference of this similar thread which has been solved.

 

If you still need help, could you please share your data sample as table, because it will take a lot time to create a data sample like the image you uploaded

 

Best Regards,

Cherry

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

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.