Filter by paramert values with if conditions

Nemat2313

New Member
Joined
Jan 18, 2016
Messages
18
Hi,

How can I add if function to below code? I want if parameter value (yonetici=All ) is equal "ALL" don't filter or filter all esle filtering by parameter value as below. Is it possibe in Power Query?
Filter by paramert values with if conditions

Code:
let    
         Source = Table.Combine({#"770 Оборот (2)", #"770 Оборот (1)"}),
         yonetici = fnGetParameter("Yonetici"),
        #"Filtered Rows1" = Table.SelectRows(Source, each ([Yonetici] = yonetici)) 
 
in
        #"Filtered Rows1"
 

MarcelBeug

Well-known Member
Joined
Apr 25, 2014
Messages
1,811
You can do it like this. Thanks to lazy evaluation, the filter step will only be executed if yonetici is not "ALL".

Code:
let    
         Source = Table.Combine({#"770 Оборот (2)", #"770 Оборот (1)"}),
         yonetici = fnGetParameter("Yonetici"),
        #"Filtered Rows1" = Table.SelectRows(Source, each ([Yonetici] = yonetici)),
        Result = if yonetici = "ALL" then Source else #"Filtered Rows1"
 
in
        Result
 
Last edited:

Forum statistics

Threads
1,086,093
Messages
5,387,793
Members
402,076
Latest member
MotoMoto

Some videos you may like

This Week's Hot Topics

Top