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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.