Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
chapil
Contributor III
Contributor III

Filter values according to a selection

Hy, 

Would like to filter in my table some TYPE, but according to a filter : 

If FR is selected select only MAG= 'Rennes'

If RU is selected select only MAG='Moscow', null())

I tried like this but doesn't work : 
=IF(GetFieldSelections(COUNTRY) = 'FR',[MAG]='Rennes',
IF(GetFieldSelections(COUNTRY) = 'RU',[MAG]='Moscow', null() ) )


Thanks again ! 

11 Replies
sunny_talwar

What object are you trying to do this in? Is this going to be used as a filter or do you need this in an expression of a chart?

chapil
Contributor III
Contributor III
Author

In a table, want to show only specific lines ! according to the country 

sunny_talwar

And this is based on selections or you always want to see these values?

chapil
Contributor III
Contributor III
Author

chapil_0-1631191450722.png

Like this, have only one table object and I want to modify the expression in Mag field but don't have the good syntax I guess. Or there is a better way to do it ? 
Thanks

 

sunny_talwar

Try this

 

=If(GetFieldSelections(COUNTRY) = 'FR',
    Sum({<[MAG] = {'Rennes'}>} Sales),
 If(GetFieldSelections(COUNTRY) = 'RU',
    Sum({<[MAG] = {'Moscow'}>} Sales), Null()))

 

 

chapil
Contributor III
Contributor III
Author

thanks I dont' need to aggr sales just to show the line 

but I will try, 

 

sunny_talwar

Oh, you don't need to Sum() it  you mean?

chapil
Contributor III
Contributor III
Author

yes that's what I mean 

sunny_talwar

You can do Only() or Avg() in that case

=If(GetFieldSelections(COUNTRY) = 'FR',
    Only({<[MAG] = {'Rennes'}>} Sales),
 If(GetFieldSelections(COUNTRY) = 'RU',
    Only({<[MAG] = {'Moscow'}>} Sales), Null()))

or

=If(GetFieldSelections(COUNTRY) = 'FR',
    Avg({<[MAG] = {'Rennes'}>} Sales),
 If(GetFieldSelections(COUNTRY) = 'RU',
    Avg({<[MAG] = {'Moscow'}>} Sales), Null()))