Forum Discussion

tlamoureux's avatar
tlamoureux
Frequent Visitor
6 years ago

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