Forum Discussion

navith's avatar
navith
Frequent Visitor
1 year ago
Solved

Need help with DAX query

Hello everyone,

 

I am a beginner to PowerBI and was exploring a few basic DAX queries.

 

In my excel work book (named data), I have the following columns and I would like to calculate the total amount based on the category.

 

OrderIDOrderDateCustomerIDCustomerNameProductIDProductNameCategoryQuantityUnitPriceTotalAmount

Region

 

I used the following formula based on the suggestion of Co-pilot however, it seems to throw an error. What could be the error and how do I rectify this?

 

TotalAmountByCategory =
CALCULATE(
SUMX(
'Sheet1',
'Sheet1'[Quantity] * 'Sheet1'[UnitPrice]
),
ALLEXCEPT('Sheet1', 'Sheet1'[Category])
)

 

Feedback will be really helpful.

 

Thanks!!

6 Replies

  • navith 

    The formula you provided is mostly correct, but the error might be due to:

    • If the table or column names in your data model are different, Power BI will throw an error.
    • The column references must exactly match the names in your Power BI data model.

    💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
    Cheers,
    Kedar
    Connect on LinkedIn

    • Ajithkumar_P_05's avatar
      Ajithkumar_P_05
      Helper I

      I believe you are executing the query in the DAX Query view. Kindly create the same logic as a new measure and include it along with the Category.