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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

filtering a table with topn

Hello

Can please someody help me to resolve a problem : i get a table but when i use my if parametre to filter it i get all values and not filtered
I use this measure : 

SUMX(TOPN('Paramètre'[Valeur Paramètre];BASE;BASE[Rank];ASC);BASE[ MARGE ACT])
And in my BASE table i created a Rank column to reference it in my measure (
Rank = RANKX(BASE;BASE[ MARGE ACT];BASE[ MARGE ACT];ASC;Dense)



scr.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

It seems like to be resolved
By putting a rank column with this measure = 

RANKX(FILTER(BASE;BASE[Date]=EARLIER(BASE[Date]));BASE[ MARGE ACT];;ASC)
I can group up my base by year so when i filter it by year my table work nice2017.png2018.png

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

Try like

var _max =max('Paramètre'[Valeur Paramètre])
// var _max =maxx('Paramètre','Paramètre'[Valeur Paramètre])
SUMX(TOPN(_max;BASE;BASE[Rank];ASC);BASE[ MARGE ACT])
Anonymous
Not applicable

It seems like to be resolved
By putting a rank column with this measure = 

RANKX(FILTER(BASE;BASE[Date]=EARLIER(BASE[Date]));BASE[ MARGE ACT];;ASC)
I can group up my base by year so when i filter it by year my table work nice2017.png2018.png
Anonymous
Not applicable

So i could find a solution as i suppose ( not sure 😃 ) by using a measure : 

CALCULATE(
SUMX(
TOPN('Paramètre'[Valeur Paramètre];BASE;BASE[Rank];ASC);BASE[ MARGE ACT]);
FILTER(BASE;BASE[ MARGE ACT]<=0&&BASE[Rank]<='Paramètre'[Valeur Paramètre]))
NOW the issue is that i cant filter by years : on my screens u see that while year filter inst applied i get all 4 values in my table however when i choose a year i get only two, however i would like to get all 4 values but for a selected year ? What do you think about it ?
Thankswith year.png

 

no year.png

 

Anonymous
Not applicable

Thanks but it doesnt work 
the same effect
here is a link to download a pbi file = http://www.filedropper.com/pizdosya
erreur.png

 

Anonymous
Not applicable

Actually even by putting a measure selectedvalue it doestn work. 'Table'[Value] - is a list of values from 1 to X

SUMX(
TOPN(SELECTEDVALUE('Table'[Value]);BASE;BASE[ MARGE ACT];ASC);BASE[ MARGE ACT])

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.