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
Teglbrander
Regular Visitor

Calculate weekly last season sales

Hi all

 

Tryed to find an already posted solution, but didn't succeed.

 

I'm trying to make a calculation to my table that shows last season weekly sales. Its the value "LY WEEK" in below table that I can't seem to create a meassure for.

 

The booking week is taken from a booking date table.

Sales data from a Sales Table where cancel date as well is shown for cancelled sales. If for example one is booked in week 1, but cancelled in week 3, the sales value of both WEEK and ACK should be included in book week 1+2 and the removed again in week 3 as it is cancelled that week.

 

I tried with the following meassure, but I recieve an error:

LY WEEK = CALCULATE(
    SUM(SALES[AMOUNT]),
    ISBLANK('SALES'[CancellationDate]) || FILTER(ALL(SALES),SALES[CancellationDate] > SAMEPERIODLASTYEAR(Bookingdate[Date])),
SAMEPERIODLASTYEAR('Depdate'[Date])

 

Pls help! 🙂

 

BookweekTY WEEKTY ACKLY WEEKLY ACK
1551010
2271020

3

310525
4 10530
5 10535
6 10742
7 10244
8 10751
total10105151

 

3 REPLIES 3
v-lionel-msft
Community Support
Community Support

Hi @Teglbrander ,

 

Has your problem been solved?

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-lionel-msft
Community Support
Community Support

Hi @Teglbrander ,

 

Maybe you can try this measure.

 LY WEEK = 
 CALCULATE(
    SUM(SALES[AMOUNT]),
    SAMEPERIODLASTYEAR('Depdate'[Date]),
    FILTER(
        ALL(SALES),
        SALES[CancellationDate] > SAMEPERIODLASTYEAR(Bookingdate[Date]) ||  ISBLANK('SALES'[CancellationDate]) = TRUE()
    )
 )

If this formula is incorrect, would you mind sharing your .pbix file?

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Teglbrander
Regular Visitor

Annotation 2020-06-05 100810.png

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.