Forum Discussion

tkavitha911's avatar
tkavitha911
Icon for Helper III rankHelper III
1 year ago
Solved

Hi Team, Pls help this dax calculated table im getting error

ADDCOLUMNS(
    SUMMARIZE(
        'Daily Inventory',
        'Daily Inventory'[Country New name]
    ),
    "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
)
),
 "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
),
 "Difference", [ThisThursdayNetInventory] - [LastThursdayNetInventory]
)
)
  • tkavitha911 , Try using

    DAX
    ADDCOLUMNS(
    SUMMARIZE(
    'Daily Inventory',
    'Daily Inventory'[Country New name]
    ),
    "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
    )
    ),
    "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
    )
    ),
    "Difference", [ThisThursdayNetInventory] - [LastThursdayNetInventory]
    )

5 Replies

  • tkavitha911 , Try using

    DAX
    ADDCOLUMNS(
    SUMMARIZE(
    'Daily Inventory',
    'Daily Inventory'[Country New name]
    ),
    "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
    )
    ),
    "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
    )
    ),
    "Difference", [ThisThursdayNetInventory] - [LastThursdayNetInventory]
    )

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi tkavitha911 

    Thank you for reaching out to the Microsoft fabric community forum. Also thank you bhanu_gautam  for providing solution.

     

    To assist you better, could you please clarify what you're trying to achieve with this calculated table? Specifically, are you looking to compare net inventory values for this Thursday versus last Thursday by country and location?

    Also, are [ThisThursdayNetInventory] and [LastThursdayNetInventory] defined measures, or are you trying to calculate them within this expression? Lastly, please share the exact error message you're encountering. This will help us provide more accurate guidance.

     

    Thank you.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi tkavitha911 ,

      I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.


      Thank you.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi tkavitha911 ,

     

    May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

     

    Thank you.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi @tkavitha911 ,

     

    May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

     

    Thank you.