Forum Discussion
misul
8 years agoHelper I
Dynamic Segmentation - with duplicate rows
Hi, I am trying to follow this blog post about Dynamic Segmentation. https://www.daxpatterns.com/dynamic-segmentation/ I am stuck on one point - what to do when there are duplicate transactions...
- 8 years ago
I have used this MEASURE in the LookUp Table
Measure = VAR mysales = CALCULATE ( SUM ( Table1[Sales] ) ) RETURN CALCULATE ( SUM ( Table1[Sales] ), FILTER ( VALUES ( Table1[Product] ), mysales >= SELECTEDVALUE ( CategoryLookup[Lower] ) && mysales < SELECTEDVALUE ( categoryLookup[Upper] ) ) )
misul
8 years agoHelper I
Zubair_Muhammad I celebrated too early. The current setup doesn't allow me to count the number of rows in each category, which is my final goal.
for example: How many products with Sales <15 in 2017 in Region North?
Zubair_Muhammad
8 years agoCommunity Champion
Hi misul
To count the products,,,,you can try this MEASURE
CountProducts =
CALCULATE (
DISTINCTCOUNT ( Table1[Product] ),
FILTER ( ALL ( Table1[Product] ), [Measure] > 0 )
)- Zubair_Muhammad8 years agoCommunity Champion
- misul8 years agoHelper I
It solves my issue. Thanks a million! Zubair_Muhammad
For reference, this post shows how to:
a. Categorise your data into buckets of 0-15, 15-100 etc
b. Distinct count those categories