Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hello All,
I am trying to replicate the logic from this blog -> https://blog.enterprisedna.co/discover-your-top-products-per-region-in-power-bi-wdax/
where the following logic is used:
to produce the following:
However I would now like to take things further... how might one adapt this logic to only analyse those products where the quantity sold was more than 100 for example?
My thinking is that I create a virtual table of these products only, along the lines of:
VAR _table = ADDCOLUMNS(VALUES(Products[Product Name]), "Count", CALCULATE(SUM(Sales[Quantity]))
VAR _filteredtable = FILTER(_table, [Count] > 100)
I am stumped however as to how to then use this _filteredtable within the TOPN function as I cannot apply the ALL function to a virtual table.
Cannot anyone help solve this problem? Thanks.
Solved! Go to Solution.
Try
Top 2 Product Per Region =
VAR RankingContext =
VALUES ( 'Product'[Product Name] )
RETURN
CALCULATE (
[Total Sales],
TOPN (
2,
FILTER (
ALL ( 'Products'[Product Name] ),
CALCULATE ( SUM ( Sales[Quantity] ) ) > 100
),
[Total Sales]
),
RankingContext
)
Try
Top 2 Product Per Region =
VAR RankingContext =
VALUES ( 'Product'[Product Name] )
RETURN
CALCULATE (
[Total Sales],
TOPN (
2,
FILTER (
ALL ( 'Products'[Product Name] ),
CALCULATE ( SUM ( Sales[Quantity] ) ) > 100
),
[Total Sales]
),
RankingContext
)
perfect! simpler than expected.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
104 | |
69 | |
48 | |
41 | |
34 |
User | Count |
---|---|
154 | |
112 | |
60 | |
54 | |
35 |