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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
helloworld12
New Member

Get Grand Total Basis Conditions

Hi,

Insert TimeProduct 1Product 2LocationCategorySupplierQtyWeek DateConditionDuplication Check
          


I have the above Table

I need a DAX which calculates the Grand Total Basis conditions.

If Condition = 1 Then Calculate Grand Total Per Week
If Condition = 2 Then Calculate Grand Total Per Week


5 REPLIES 5
MasonMA
Resident Rockstar
Resident Rockstar

Hello @helloworld12 

 

If there’s exactly one condition in the current filter context, you can try the DAX logic below, 

SWITCH(
    TRUE(),
    SELECTEDVALUE('Table'[Condition]) = 1,
        CALCULATE(
            SUM('Table'[Qty]),
            ALLEXCEPT('Table', 'Table'[Week Date])
        ),
    SELECTEDVALUE('Table'[Condition]) = 2,
        CALCULATE(
            SUM('Table'[Qty]),
            ALLEXCEPT('Table', 'Table'[Week Date])  //adjust if logic differs
        )
)

ALLEXCEPT('Table', 'Table'[Week Date]) forces totals at the week level, ignoring product, supplier, category, etc. 

Hi @helloworld12 
@MasonMA @FBergamaschi Thanks for the inputs.

I hope the information provided by users was helpful. If you still have questions, please don't hesitate to reach out to the community.

 

Hi @helloworld12 

I wanted to check if you had the opportunity to review the information provided by users. Please feel free to contact us if you have any further questions.

Hi @helloworld12 

Hope everything’s going smoothly on your end. I wanted to check if the issue got sorted. if you have any other issues please reach community.

FBergamaschi
Solution Sage
Solution Sage

Hi @helloworld12, a coupld of things

 

1 - Can you please clarify the below? It seems the same thing is requested in both conditions

If Condition = 1 Then Calculate Grand Total Per Week
If Condition = 2 Then Calculate Grand Total Per Week

2 - Please include, in a usable format, not an image, a small set of rows for each of the tables involved in your request and show the data model in a picture, so that we can import the tables in Power BI and reproduce the data model. The subset of rows you provide, even is just a subset of the original tables, must cover your issue or question completely. Alternatively, you can share your .pbix via some cloud service and paste the link here. Do not include sensitive information and do not include anything that is unrelated to the issue or question. Please show the expected outcome based on the sample data you provided and make sure, in case you show a Power BI visual, to clarify the columns used in the grouping sections of the visual.

 

Need help uploading data? click here

 

Want faster answers? click here

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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