Forum Discussion
Sum based on filters
- Anonymous8 years ago
Dan_W,
Please check if the following DAX returns your expected result. If not, please share source file via OneDrive.Grand Total = var MaxValue = MAX(Sheet1[QTY]) var MinValue = MIN(Sheet1[QTY]) var Interval Total = MaxValue - MinValue Return SUMX( CALCULATETABLE( ALLSELECTED(Sheet1[ASSET])), Interval Total)
Regards,
Lydia - 8 years ago
Thank you Lydia -your suggestion worked perfectly.
I have gotten a little closer:
My inital measures were:
MaxValue = MAX(Sheet1[QTY]) MinValue = MIN(Sheet1[QTY])
Interval Total = [MaxValue] - [MinValue]
Giving me this:
I tried using SUMX to iterate a table like above - and can now get the totals (i'm not sure if that is exactly what is going on?)
Grand Total = SUMX(
CALCULATETABLE(
ALLSELECTED(Sheet1[ASSET])),
([MaxValue]-[MinValue]))
Somehow I got where I intended - not really sure how, but is there a way to clean my "Grand Total" measure?
How can I get rid of the intermediary steps of having the MIN and MAX measures?
When I exchange the measures [Maxvalue] for the underlying calculation MAX('sheet1[QTY]) - my results are incorrect?
Thanks
Dan_W,
Please check if the following DAX returns your expected result. If not, please share source file via OneDrive.
Grand Total = var MaxValue = MAX(Sheet1[QTY])
var MinValue = MIN(Sheet1[QTY])
var Interval Total = MaxValue - MinValue
Return
SUMX(
CALCULATETABLE(
ALLSELECTED(Sheet1[ASSET])),
Interval Total)
Regards,
Lydia
- Dan_W8 years agoFrequent Visitor
Thank you Lydia -your suggestion worked perfectly.