Quantcast
Channel: Desktop topics
Viewing all articles
Browse latest Browse all 213916

Help with complex nested IF function created as Query, with AND and OR operators

$
0
0

Dear BI community. Once again I ask your kind help with the following issue: I have a table which contains a team description, a date, a test result and a region for every purchaser. I'm trying to create a custom function so that I can invoke  it every time I want on any query. It is a really complex function but in order to sum up, the purchaser that meets the following 3 conditions gets the price:

 

1. The team must be either "A" or the test result must be different to "Negative".

 

2. The date must be between january and june.

 

3. The region must be either "Center" or "East Coast".

 

The table looks as follows: The purchasers that would receive the prize are 1, 3, 8 and 11. Below you can see the table and the code I'm trying to use. I've tried with && and  ‖, but it doesn't work either. I'd really appreciate your help guys!!. Thanks.

 

let
   SuperFunction= (Team,Date,Region,Test) =>

if Team = "A" Or (Test <> "Negative") and (Date>= 1/1/2016 and Date<=6/1/2016) and (Region = "Center" or Region = "East Coast") then "Gets Prize" else

"Doesn't get Prize"

in
    SuperFunction

 

 

 

Table sample.jpgAs I told you before, I'd like to be able to invoke the function, from a query and choose the parameters.

 

 

 


Viewing all articles
Browse latest Browse all 213916

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>