cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

DAX: SubFigure logic to cater priority on date slicer first, then group by columns to sum qty

Hi friends,

I need the subtotal based on grouping included date filtering applied at first.

Priority: 1: date slicer filtering

             2: sort by Ckey, ItemNo, DB_Ind, Entry No

             3: group by Ckey, ItemNo

             4: sum qty for inventory OUT only

But currently logic only able cater for item 2,3,4.

 

The first screen showing sample of raw data about overall inventory including inventory IN & inventory OUT.
inventory IN: Entry Type in {0,2,6}               inventory OUT: Entry Type in {1,3,5}

RawSampleRawSample

 

Screen below is what currently I can get the correct result by applying below logic.

InventoryOUTQty = 
SUMMARIZE(FILTER(V_ItemLedgerEntry,V_ItemLedgerEntry[EntryType] in {1,3,5}),"InventoryOUT",SUM(V_ItemLedgerEntry[InvoiceQty]))
Subtotal_InvOUTQty =
CALCULATE([InventoryOUTQty],ALLEXCEPT(V_ItemLedgerEntry,V_ItemLedgerEntry[CKey],V_ItemLedgerEntry[Item No_]))

Result1_DefaultResult1_Default

Btw, I cant get the result below if date slicer is selected, it still showing overall subtotal as -26 instead of -1.

Result_SelectionOnDateSlicerResult_SelectionOnDateSlicer

 

Thank you.

XioFen

 

2 REPLIES 2
Highlighted
Super User IV
Super User IV

Re: DAX: SubFigure logic to cater priority on date slicer first, then group by columns to sum qty

I am not sure I follow. You say you are getting the correct result. So that's good right? 

 

It sort of sounds like a measures total issue to me but that's a complete guess. This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907


---------------------------------------

Putting square pegs in round holes since 1972.

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Highlighted
Frequent Visitor

Re: DAX: SubFigure logic to cater priority on date slicer first, then group by columns to sum qty

Hi Mr. Greg,

 

Yes, I am getting correct subfigure if no filter for date slicer (default showing all record). But if do some selection on date slicer, the subfigure will be wrong because it still showing grouping based on all record instead of record after applied date slicer filtering.

 

Thank you.

Xio Fen

Helpful resources

Announcements
Super Users of the Quarter - Q2 2020

Super Users of the Quarter - Q2 2020

Who are our Super User Superstars? Who made it to the top of the leaderboards? Get the answers!

June 2020 Community Highlights

June 2020 Community Highlights

Featured community members, changes to the Community, and more! Read up on recent Power BI community news.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021