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
Anonymous
Not applicable

How to display the expected result

Hi All Experts,
I have an issue with my measure, i am not able to get expected results.


measure 1
var v1 = IF( FIRSTNONBLANK('Item'[ITEM_TYPE], 'Item'[ITEM_TYPE]) IN {"FG-1","FG-2","FG-3","04-FG","FG-05","FG-07","FG-08"},"Y","N")

var v2 = IF([Last 12 months v5-Sales]<>0,"Y",v1)
return v2

[Last 12 months v5-Sales] - this is a measure, in this measure we are calculating sum of sales for last 12 months from the user picked date.
User picked date means ex: if user picks year- 2022 and month - oct, then sum of sales will be calculated from oct 2022 to oct 2021.

This is my measure, based on the above measure, it need to display "y", where we have the "[Last 12 months v5-Sales]<>0" and where item_type is any of these ("FG-1","FG-2","FG-3","04-FG","FG-05","FG-07","FG-08"). But with above measure, you can see, i am getting result as "Y", only when this ("[Last 12 months v5-Sales]<>0") is satisfied. it is not considering the second condition the item_type. I want to display the result as "Y", where anyone of the condtion is satisfied.

5 REPLIES 5
SergioSilvaPT
Resolver V
Resolver V

Hi @Anonymous ,

 

Don't know if this is what you need but here is someting similar with a PBI exmple in attach.

 

If profit > 3.000.000 and country is France or Germany shows  "Y" else shows "N".

SergioSilvaPT_0-1672075264716.png

Regards,
Sérgio Silva

If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Check out my blog for tips and tricks about Power BI: https://pbibits.wordpress.com/

Regards,
Sérgio Silva

If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Check out my blog for tips and tricks about Power BI: https://pbibits.wordpress.com/
Anonymous
Not applicable

Hi Sérgio Silva,
I have gone through your attachement, it didn't work for me .
i need to provide all these item_typ = ("FG-1","FG-2","FG-3","04-FG","FG-05","FG-07","FG-08") and this "[Last 12 months v5-Sales]<>0".


1. If this "[Last 12 months v5-Sales]" is having value then it should be "Y".
2. If the item_type is anyone from above and if the "[Last 12 months v5-Sales]" value is blank for it then also it should display "Y".

@Anonymous i don't know the name of your columns but this should work, just replace the

table[Category] with the table and column from your category.

 

Example:

 

Metric Name = 
IF(
    [Last 12 months v5-Sales] <> 0,
    "Y",
    IF(
        ISBLANK([Last 12 months v5-Sales]) &&
            SELECTEDVALUE(table[Category]) ="FG" ||
            SELECTEDVALUE(table[Category]) = "FGS" ||
            SELECTEDVALUE(table[Category]) = "FGD-SKU" ||
            SELECTEDVALUE(table[Category]) = "04-FG" ||
            SELECTEDVALUE(table[Category]) = "FG-PARENT" ||
            SELECTEDVALUE(table[Category]) = "TANDEM FG" ||
            SELECTEDVALUE(table[Category]) = "FG-FG",
        "Y",
        "N"
    )
)

 

 

Regards,
Sérgio Silva

If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Check out my blog for tips and tricks about Power BI: https://pbibits.wordpress.com/
Anonymous
Not applicable

Hi Sérgio Silva,

I have tried the measure provided by you, its not displaying values as expected.

When i remove a page level filter that is applied, the values are coming as expected.  I tried to provide "ALL(country[country name])" in the measure, to restrict that page level filter column. But it didn't work.

@Anonymous Is it possible to share the dataset with the problem so i can check?

Regards,
Sérgio Silva

If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Check out my blog for tips and tricks about Power BI: https://pbibits.wordpress.com/

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.