Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
tlamoureux
Frequent Visitor

Dynamic segmentation

Hello,

I am trying to give a chance to PowerBI and so I'm migrating the most representative of my Qlik Sense report.

I am facing an issue with something I call here dynamic segmentation.

My report aims to display rank statistics on shop :

  • There is a query (query1) with shops name et properties :
ShopIDShopNameShopTown
1Shop1Toulouse
2Shop2Toulouse
3Shop3Nice
  • Then a query (query2) with daily shop performance ranking
ShopIDDateDailyRank
112/01/20205,6
113/01/20206,2
114/02/20207
212/01/20208,5
...  
  • And finally a query (query3) with the last rank (by date)
ShopIDLastRank
16,9
28,2

 

My report is obvously composed of several filters :

  • ShopName
  • ShopTown
  • Year
  • Year-Week
  • Year-Month

And several graphs :

  • Table with ShopName and LastRank
  • Graph (curve) with average rank evolution by Year-Month (2019-01, 2019-02, ...) or Year-Week (2019-40, 2019-41, ...)
  • A bar graph with the total of shop by rank segmentation

My issue is for the last element. First of all, the segmentation is quite simple : it is a floor of the average rank :

SegmentMinRankMaxRank
000,99
111,99
222,99
333,99
444,99
555,99
666,99
777,99
888,99
999,99

 

In Qlik Sense, it is very simple, I have created a dimension with the formula : RankSegment=FLOOR(AGGR(AVG(Query2[Rank]), Query2[Shop])) :

  • AGGR(AVG(Query2[Rank]), Query2[Shop]) : Create an aggregation on Rank average, by Shop taking to account the active filter (this seems difficult with PowerBI)
  • FLOOR : Give the segment

To end, I had just to create a bar graph using RankSegment as dimension and COUNT(Query2[Shop]) as measure.

I think the trick must be done in the report and not in the request window, otherwise the filters applied in the report will not be take to account. Indeed, the number of shops in the rank 9 in 2019 is not the same that the number of shops in 2020.

I hope I've been clear enough.

Thank you very much for your help.

Regards,

Thierry

4 REPLIES 4
amitchandak
Super User
Super User

Not very clear, but refer

https://community.powerbi.com/t5/Desktop/BIN-Range-Dynamic-Segmentation-based-on-measure/m-p/879288

https://community.powerbi.com/t5/Desktop/Dynamic-Segmentation-with-duplicate-rows/m-p/379859

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hello,

Thank you for your answer but I have already found this thread and it does not help.

Here is a simple illustration of what I need.

If query2 is composed of these elements :

ShodIDShopNameDate

Rank

1Toulouse01/01/20198
1Toulouse02/01/20198
1Toulouse03/01/20198
1Toulouse01/01/20209
1Toulouse02/01/20209
2Nice01/01/20196

 

If I apply no filter, I will have this result

RankNumber Of Shop
00
10
20
30
40
50
61
70
81
90

Then, if I apply the filter Year=2020, the result will be :

RankNumber Of Shop
00
10
20
30
40
50
60
70
80
91

First I calculate the aggregation on the average in the time periode and then I apply the floor function to obtain the rank.

Thanks for help.

Thierry

Hi,

I'm still stuck with this problem. Can someone help ?

Thank you very much,

Thierry.

Hello,

I've found by myself but I still have some question. I used this thread with the bellow DAX formula :

Segmented stores =
COUNTROWS (
    FILTER (
        ADDCOLUMNS (
            VALUES ( Data[StoreID] ),
            "ABCD",
            CALCULATE (
                [Total sales],
                CALCULATETABLE ( VALUES ( Data[StoreID] ) ),
                ALLSELECTED ()
            )
        ),
        COUNTROWS (
            FILTER (
                Buckets,
                [Total sales] >= Buckets[Lower]
                    && [Total sales] <= Buckets[Upper]
            )
        ) > 0
    )
)

I've two questions, the first is about the CALCULATE, I don't understand why the VALUES(Data[StoreID]) is in the CALCULATETABLE function. If I only put the VALUES function it does not work but I do not see the difference as there is no argument for CALCULATETABLE. Then, I do not understand the goal of the ALLSELECTED(), if delete this line, I have the same result.

 

I have inserted in my report this bar graph :

range.PNG

The value are exactly what I expected but, when I click on a bar, the other element of my report are not updated : if I click on the bar "0 à 1", the list of shops may be reduced to a number of 5. Do you have an idea why it does not work ?

 

Thank you very much,

Thierry

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors