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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
kenthub
Helper I
Helper I

Week to date so far

Ok first, please rest assured I have looked through what I presummed all possible answers in the forums first 😄

 

I am trying to create a matrix table that compares sales from the current week and previous week with the sales variance. Now here is my problem, the sales for current week will not populate unless that week is full ( as in monday - sunday). 

 

My formula works on dummy data and if I change it on this current data to 4 weeks, 3 weeks, 2 weeks, 1 week back it works. 

 

My question is how do I get the current cummulative total to show without it wanting to finish out the week? 

 

Sales-CWeek = CALCULATE([SalesTotal], SalesEntry[YearWeek] = WEEKNUM(NOW(),2) )

This will be a daily refreshed argument for our clients so they can keep track of where they are at for the week verses the previous week. 

 

 

BI-Connections.PNG

matrix-bi.PNG

1 ACCEPTED SOLUTION
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @kenthub,

 

Could you try the formula below to see if it works?Smiley Happy

Sales-CWeek =
CALCULATE (
    [SalesTotal],
    FILTER (
        'PeriodDate',
        YEAR ( 'PeriodDate'[Date] ) = YEAR ( NOW () )
            && WEEKNUM ( 'PeriodDate'[Date], 2 ) = WEEKNUM ( NOW (), 2 )
    )
)

 

Regards

View solution in original post

2 REPLIES 2
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @kenthub,

 

Could you try the formula below to see if it works?Smiley Happy

Sales-CWeek =
CALCULATE (
    [SalesTotal],
    FILTER (
        'PeriodDate',
        YEAR ( 'PeriodDate'[Date] ) = YEAR ( NOW () )
            && WEEKNUM ( 'PeriodDate'[Date], 2 ) = WEEKNUM ( NOW (), 2 )
    )
)

 

Regards

Worked!  Thanks so much!

 

I tried something similar by setting a second filter for the current year in the Calculate function but it wasn't showing as correct. I presume the filter function simplifies that and/or makes it easier when crunching dates? 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.