Forum Discussion
Summing a Range Based on Serial Numbers
- Anonymous1 year ago
Hi trathman ,
Thanks for Ashish_Mathur and DataNinja777 replies and efforts.Based on your description and their suggestions, here is the sample data and MEASURE I created
To make sure slicer works, there should be no relationship between the tables
Create a measure
Total = VAR SerialStart = SELECTEDVALUE(SlicerTableA[ValueA]) * 10000 + SELECTEDVALUE(SlicerTableB[ValueB]) * 100 + SELECTEDVALUE(SlicerTableC[ValueC]) VAR SerialEnd = SELECTEDVALUE(SlicerTableA[ValueA]) * 10000 + SELECTEDVALUE('SlicerTableB'''[ValueB']) * 100 + SELECTEDVALUE('SlicerTableC'''[ValueC']) RETURN CALCULATE( SUM(BookDtl[BookAmt]), FILTER( BookDtl, BookDtl[Serial] >= SerialStart && BookDtl[Serial] <= SerialEnd ) )Final output
Best regards,
Albert HeIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi trathman ,
Thanks for Ashish_Mathur and DataNinja777 replies and efforts.
Based on your description and their suggestions, here is the sample data and MEASURE I created
To make sure slicer works, there should be no relationship between the tables
Create a measure
Total =
VAR SerialStart =
SELECTEDVALUE(SlicerTableA[ValueA]) * 10000 +
SELECTEDVALUE(SlicerTableB[ValueB]) * 100 +
SELECTEDVALUE(SlicerTableC[ValueC])
VAR SerialEnd =
SELECTEDVALUE(SlicerTableA[ValueA]) * 10000 +
SELECTEDVALUE('SlicerTableB'''[ValueB']) * 100 +
SELECTEDVALUE('SlicerTableC'''[ValueC'])
RETURN
CALCULATE(
SUM(BookDtl[BookAmt]),
FILTER(
BookDtl,
BookDtl[Serial] >= SerialStart &&
BookDtl[Serial] <= SerialEnd
)
)
Final output
Best regards,
Albert He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly