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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
BenPo
Frequent Visitor

Measure Totals Calculation

Hello!

Baseline calculation returns inventory amount for Friday if Saturday is 0/blank.

if(CALCULATE(sumx(InventoryTable,InventoryTable[CountTotal]),filter(Date,Date[FiscalDayOfWeek]=7))=0,
CALCULATE(sumx(InventoryTable,InventoryTable[CountTotal]),filter(Date,Date[FiscalDayOfWeek]=6)),
CALCULATE(sumx(InventoryTable,InventoryTable[CountTotal]),filter(Date,Date[FiscalDayOfWeek]=7)))
 
When I drop this in a matrix with a location hierarchy (Area, Region, Plant) + product the totals don't add up correctly. I've read and tried solutions using "isfiltered" and "summarize" but I don't understand how to use those in case.
 Example of Matrix
Row LabelsWE Inv.
Area 1150,000
  Region 130,000
    Plant12,500
       Prod 110,000
      Prod 21,000
      Prod 31500
   Plant 225,000
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@BenPo , You have to try like

Inv =if(CALCULATE(sumx(InventoryTable,InventoryTable[CountTotal]),filter(Date,Date[FiscalDayOfWeek]=7))=0,
CALCULATE(sumx(InventoryTable,InventoryTable[CountTotal]),filter(Date,Date[FiscalDayOfWeek]=6)),
CALCULATE(sumx(InventoryTable,InventoryTable[CountTotal]),filter(Date,Date[FiscalDayOfWeek]=7)))

 

 

New Inv = sumx(summarize(Table, [Region], [area], [plant], [product], "_1",[Inv]),[_1])

View solution in original post

3 REPLIES 3
BenPo
Frequent Visitor

Thank you, amitchandak!

v-yiruan-msft
Community Support
Community Support

Hi @BenPo ,

Please create another new measure as below base on your original measure and check whether it can work in your scenario:

SUMX (
    GROUPBY (
        InventoryTable,
        'InventoryTable'[Area],
        'InventoryTable'[Region],
        'InventoryTable'[Plant]
    ),
    [Yourmeasure]
)

If the above one is not working, you can also refer the method in the following links to get it. Or you can provide some sample data in your InventoryTable and the formula of measure [CountTotal], later we will check and provide the solution.

Clever Hierarchy Handling in DAX

Use IsInScope to get the right hierarchy level in DAX

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

@BenPo , You have to try like

Inv =if(CALCULATE(sumx(InventoryTable,InventoryTable[CountTotal]),filter(Date,Date[FiscalDayOfWeek]=7))=0,
CALCULATE(sumx(InventoryTable,InventoryTable[CountTotal]),filter(Date,Date[FiscalDayOfWeek]=6)),
CALCULATE(sumx(InventoryTable,InventoryTable[CountTotal]),filter(Date,Date[FiscalDayOfWeek]=7)))

 

 

New Inv = sumx(summarize(Table, [Region], [area], [plant], [product], "_1",[Inv]),[_1])

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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