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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
tkavitha911
Helper III
Helper III

Hi Team, help this dax measure

I have the measure for yesterday, and I want to calculate the values for this Thursday and last Thursday using DAX. Could someone please help me

CALCULATE(
    [Net Inventory mUSD],
    FILTER(
        ALLEXCEPT('Daily Inventory', 'Daily Inventory'[Country New name], 'Daily Inventory'[Location_c], 'Daily Inventory'[Type]),
        'Daily Inventory'[Date] =
            VAR YesterdayDate = MAX('Daily Inventory'[Date]) - 1
            RETURN
                SWITCH(
                    WEEKDAY(YesterdayDate),
                    1, YesterdayDate - 2,
                    7, YesterdayDate - 1,
                    YesterdayDate
                )
    )
)


1 ACCEPTED SOLUTION

Hi @tkavitha911

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.

Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

View solution in original post

8 REPLIES 8
v-hashadapu
Community Support
Community Support

Hi @tkavitha911 , could you please share more details with us to help solve your issue. If it is already solved, please share the answer here and mark it 'Accept as Solution', so others with similar queries may find it easily.
Thank you.

v-hashadapu
Community Support
Community Support

Hi @tkavitha911 , Please let us know if your issue is solved. If it is, consider marking the answer that helped 'Accept as Solution', so others with similar queries can find it easily. If not, please share the details.
Thank you.

v-hashadapu
Community Support
Community Support

Hi @tkavitha911 , Please let us know if your issue is solved. If it is, consider marking the answer that helped 'Accept as Solution', so others with similar queries can find it easily. If not, please share the details.
Thank you.

Not working 

 

Hi @tkavitha911

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.

Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

bhanu_gautam
Super User
Super User

@tkavitha911 , Try using

DAX
// Measure for This Thursday
ThisThursdayNetInventory =
CALCULATE(
[Net Inventory mUSD],
FILTER(
ALLEXCEPT('Daily Inventory', 'Daily Inventory'[Country New name], 'Daily Inventory'[Location_c], 'Daily Inventory'[Type]),
'Daily Inventory'[Date] =
VAR TodayDate = TODAY()
VAR ThisThursdayDate = TodayDate + (5 - WEEKDAY(TodayDate, 2))
RETURN ThisThursdayDate
)
)

// Measure for Last Thursday
LastThursdayNetInventory =
CALCULATE(
[Net Inventory mUSD],
FILTER(
ALLEXCEPT('Daily Inventory', 'Daily Inventory'[Country New name], 'Daily Inventory'[Location_c], 'Daily Inventory'[Type]),
'Daily Inventory'[Date] =
VAR TodayDate = TODAY()
VAR LastThursdayDate = TodayDate - WEEKDAY(TodayDate, 2) - 2
RETURN LastThursdayDate
)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






I need to calculate data for the current week and the previous week, specifically focusing on Thursdays. Please provide a DAX measure to achieve this.

Hi @tkavitha911 , Thank you for reaching out to the Microsoft Community Forum.

 

Please try below measures:

 

  1. Current Week's Thursday Net Inventory

CurrentWeekThursdayNetInventory :=

VAR YesterdayDate = MAX('Daily Inventory'[Date]) - 1

VAR DaysToThursday = 5 - WEEKDAY(YesterdayDate, 2) // 5 = Thursday in a Monday=1 calendar

VAR CurrentThursday = YesterdayDate + DaysToThursday

RETURN

CALCULATE(

    [Net Inventory mUSD],

    FILTER(

        ALLEXCEPT(

            'Daily Inventory',

            'Daily Inventory'[Country New name],

            'Daily Inventory'[Location_c],

            'Daily Inventory'[Type]

        ),

        'Daily Inventory'[Date] = CurrentThursday

    ),

    NOT ISBLANK('Daily Inventory'[Date])

)

 

  1. Previous Week's Thursday Net Inventory

PreviousWeekThursdayNetInventory :=

VAR YesterdayDate = MAX('Daily Inventory'[Date]) - 1

VAR DaysToThursday = 5 - WEEKDAY(YesterdayDate, 2)

VAR PreviousThursday = YesterdayDate + DaysToThursday - 7

RETURN

CALCULATE(

    [Net Inventory mUSD],

    FILTER(

        ALLEXCEPT(

            'Daily Inventory',

            'Daily Inventory'[Country New name],

            'Daily Inventory'[Location_c],

            'Daily Inventory'[Type]

        ),

        'Daily Inventory'[Date] = PreviousThursday

    ),

    NOT ISBLANK('Daily Inventory'[Date])

)

 

If this helped solve the issue, please consider marking it 'Accept as Solution' so others with similar queries may find it more easily. If not, please share the details, always happy to help.
Thank you.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.