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] ) ) )
Zubair_Muhammad
8 years agoCommunity Champion
HI misul
Sorry for late reply.
Actually this way MEASURE will return values/sales amount which can be shown in VALUES section of TABLE or MATRIX visualization
If you create a MEASURE to compute categories in the fact TABLE..you cannot put them in TABLE rows
If you could copy paste some sample data from Excel.... I will try to work it out for you by creating a small pbix file
misul
8 years agoHelper I
Zubair_Muhammad I also found that link, that's how I knew my problem is called "dynamic segmentation". I will try to follow the link again, but couldn't translate it to my solution.
Here are my tables.
Table 1
| Year | Product | Sales | Region |
| 2016 | A | 5 | North |
| 2016 | A | 5 | North |
| 2016 | A | 10 | South |
| 2017 | A | 10 | East |
| 2016 | B | 3 | East |
| 2017 | B | 2000 | South |
| 2016 | C | 5 | West |
| 2016 | C | 5 | North |
| 2016 | D | 23 | West |
| 2017 | D | 1 | South |
| 2016 | E | 2 | North |
| 2016 | E | 1 | South |
| 2017 | E | 50 | West |
| 2017 | F | 13 | East |
CategoryLookup Table
| Lower | Upper | Description | SortOrder |
| 0 | 14 | <15 | 1 |
| 15 | 99 | 15-100 | 2 |
| 100 | 499 | 100-500 | 3 |
| 500 | 9999 | >500 | 4 |