Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
Hi,
I am working on matrix to create the net sales data of 4 years (2019,2020,2021,2022) but I want to do the top N only on one year and still want to see the other years as well
so I want only the 2021 year to be filtered by top N rest of the years can remain the there without affected by top N filter on 2021? is something like this possible
Solved! Go to Solution.
Hi,
I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.
I tried to create a sample pbix file like below, and I hope it helps to provide some ideas on how to create a new measure for your data model.
Quantity total conditional measure: =
VAR _topthreetable2021 =
TOPN (
3,
FILTER ( ALL ( Data ), Data[Year] = 2021 ),
CALCULATE ( SUM ( Data[Quantity] ) ), DESC
)
RETURN
IF (
HASONEVALUE ( 'Year'[Year] ),
IF (
SELECTEDVALUE ( 'Year'[Year] ) = 2021,
CALCULATE ( SUM ( Data[Quantity] ), KEEPFILTERS ( _topthreetable2021 ) ),
SUM ( Data[Quantity] )
)
)
HI Jihwan,
thanks for the reply. I want the other following years values remain the same (like in excel we have an option to sort only one column and rest of the columns will have values corresponding to the sorted column. similarly in power Bi I want t to pick the top N based on 2021 data.
I also tried the formula you suggested but I get errors which I cannot understand. I am using proper syntax and parameters but still shows syntax....
Hi,
I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.
I tried to create a sample pbix file like below, and I hope it helps to provide some ideas on how to create a new measure for your data model.
Quantity total conditional measure: =
VAR _topthreetable2021 =
TOPN (
3,
FILTER ( ALL ( Data ), Data[Year] = 2021 ),
CALCULATE ( SUM ( Data[Quantity] ) ), DESC
)
RETURN
IF (
HASONEVALUE ( 'Year'[Year] ),
IF (
SELECTEDVALUE ( 'Year'[Year] ) = 2021,
CALCULATE ( SUM ( Data[Quantity] ), KEEPFILTERS ( _topthreetable2021 ) ),
SUM ( Data[Quantity] )
)
)
I figured it out its working now . thanks for the help
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 64 | |
| 51 | |
| 46 | |
| 23 | |
| 19 |
| User | Count |
|---|---|
| 136 | |
| 110 | |
| 50 | |
| 32 | |
| 29 |