lundi 6 mai 2019

Import range with 4 condition

I created a dashboard with 2 drop-down list option (Region and Business Line). Each drop-down menu has "All" option to select all option.

Menu 1 - Region : Asia, DACH, North America, All
Menu 2 - Business line: CROF, CROC, Communication, All
Menu 3 - Date filter

-Condition 1: When Menu 1 is "ALL" then import range from all region and one of Menu 2 option
-Condition 2: When Menu 2 is "ALL" then import range from all business line and one of Menu 1 option
-Condition 3: When Menu 1 and 2 are "ALL" then import range only based on the date filter
-Condition 4: When Menu 1 and 2 are select to individual option

I have tried to use

=IFS(B3="'All'", QUERY(IMPORTRANGE("14dZCHHnIWNgnE7aufM6Uv7XZkYjViKiVN2J2NLAsIjg", "'Main Calendar'!A:A1000"),"Select Col1, Col2, Col3, Col4, Col5, Col6, Col7, Col8, Col9, Col10, Col11, Col12, Col19, Col32 where Col2>=date'"&TEXT(B5,"yyyy-mm-dd")&"' AND Col3<=date'"&TEXT(B6,"yyyy-mm-dd")&"' AND Col10='"&B4&"'"), 
B4="'All'", QUERY(IMPORTRANGE("14dZCHHnIWNgnE7aufM6Uv7XZkYjViKiVN2J2NLAsIjg", "'Main Calendar'!A:AG"),"Select Col1, Col2, Col3, Col4, Col5, Col6, Col7, Col8, Col9, Col10, Col11, Col12, Col19, Col32 where Col2>=date'"&TEXT(B5,"yyyy-mm-dd")&"' AND Col3<=date'"&TEXT(B6,"yyyy-mm-dd")&"' AND Col32='"&B3&"'"), 
AND(B3="All",B4="All"),QUERY(IMPORTRANGE("14dZCHHnIWNgnE7aufM6Uv7XZkYjViKiVN2J2NLAsIjg", "'Main Calendar'!A:AG"),"Select Col1, Col2, Col3, Col4, Col5, Col6, Col7, Col8, Col9, Col10, Col11, Col12, Col19, Col32 where Col2>=date'"&TEXT(B5,"yyyy-mm-dd")&"' AND Col3<=date'"&TEXT(B6,"yyyy-mm-dd")&"'"), 
TRUE, 
QUERY(IMPORTRANGE("14dZCHHnIWNgnE7aufM6Uv7XZkYjViKiVN2J2NLAsIjg", "'Main Calendar'!A:AG"),"Select Col1, Col2, Col3, Col4, Col5, Col6, Col7, Col8, Col9, Col10, Col11, Col12, Col19, Col32 where Col2>=date'"&TEXT(B5,"yyyy-mm-dd")&"' AND Col3<=date'"&TEXT(B6,"yyyy-mm-dd")&"' AND Col32='"&B3&"' AND Col10='"&B4&"'"))

This is the dashboard that I expected http://tinypic.com/r/2lj4b3p/9

Your help is valuable, Thanks a lot

Aucun commentaire:

Enregistrer un commentaire