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
Gaurav_Lakhotia
Helper III
Helper III

Evaluating the Logic as per Data Slicer Applied

Hi All,

I need your help in creating a measure,

 

Here is the scenario,
1. A company provide various services (A,B,C....) to different clients.
2. These services are provided on different contact dates e.g. A can be provided on 1st Oct while B can be provided on 5th Oct to the same client.
3. The dataset has a row for each contact and columns for different services.
4. If a client has received certain set of services during selected period then this client is called "Reached"
5. The condition for declaring a client "Reached" are as

Client =
IF (A OR B OR C = True
AND
D is not blank OR E is true
AND
F OR G = true
AND
H > 0 OR J > 0 OR K = True), "Reached" )

Note: If we select a date range, the above condtion should work as per the given date range. We have to take care of client name also.


Here is the file with Sample Data .

 

Thanks

4 REPLIES 4
v-shex-msft
Community Support
Community Support

Hi  @Gaurav_Lakhotia,

I'd like to suggest you do 'unpivot column' on your condition fields to convert them to attribute and value, then you can use two fields to accurately control the if statement and conditions.

Unpivot columns (Power Query) 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Payeras_BI
Super User
Super User

Hi @Gaurav_Lakhotia ,

 

Here goes my try:

 

Reached measure =
SWITCH(
TRUE(),
("T" IN VALUES ('Table'[A]) ||"T" IN VALUES ('Table'[B]) || "T" IN VALUES ('Table'[C]))
&& ("Yes" IN VALUES ('Table'[D]) || "T" IN VALUES ('Table'[E]))
&& ("T" IN VALUES ('Table'[F]) || "T" IN VALUES ('Table'[G]))
&& ( SUM ('Table'[H]) > 0 || SUM ('Table'[J]) > 0|| "T" IN VALUES ('Table'[K])),
"REACHED","NOT REACHED"
)
 
Regards,
If this post answered your question, please mark it as a solution to help other users find useful content.
Kudos are another nice way to acknowledge those who tried to help you.

J. Payeras
Mallorca, Spain

Hi @Gaurav_Lakhotia ,

 

Could you try the proposed measure in your sample data? Did it work as expected?

 

Reached measure =
SWITCH(
TRUE(),
("T" IN VALUES ('Table'[A]) ||"T" IN VALUES ('Table'[B]) || "T" IN VALUES ('Table'[C]))
&& ("Yes" IN VALUES ('Table'[D]) || "T" IN VALUES ('Table'[E]))
&& ("T" IN VALUES ('Table'[F]) || "T" IN VALUES ('Table'[G]))
&& ( SUM ('Table'[H]) > 0 || SUM ('Table'[J]) > 0|| "T" IN VALUES ('Table'[K])),
"REACHED","NOT REACHED"
)

 

If this post answered your question, please mark it as a solution to help other users find useful content.
Kudos are another nice way to acknowledge those who tried to help you.

J. Payeras
Mallorca, Spain

Hi again @Gaurav_Lakhotia,

 

I could not post before the screenshots of the measure working.

 

See below:

 

Payeras_BI_1-1604672651285.png

Regards,

 

 

Payeras_BI_0-1604672618569.png

 

If this post answered your question, please mark it as a solution to help other users find useful content.
Kudos are another nice way to acknowledge those who tried to help you.

J. Payeras
Mallorca, Spain

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.

Top Solution Authors