Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
xiumi_hou
Post Partisan
Post Partisan

Need help to build if two measures (if)

 I have five variables: A, A1, B, B1 ,C and I want to create two measures, Can someone kindly help me build the dax function? Thanks!

 

1. IF C=0, show "Not available" IF not then: 

         IF A1-A>=6  or B1-B>=4, show "Yes"

         otherwise, show "No" 

 For all other conditions, show NULL

 

2. IF C=0, show "Not available" IF not then: 

       If (B1>=8 or A1>=10) and (B1<8 and A1<6) , show "Yes"

      otherwise, show "No" 

   For all other conditions, show NULL

 

    

2 ACCEPTED SOLUTIONS

Try

IF(C=0,"Not available",If((B1>=8 || A1>=10) && (B1<8 && A1<6) , "Yes","No"))

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.

My Recent Blog - https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

Hi @xiumi_hou ,

 

Please update the formulas of  BaseLineBaseDate and BaseLineActurlDate as below to check again.

BaseLineBaseDate = MINX(AllSELECTED (Score_GAD7),Score_GAD7[GAD.session_date])
BaseLineActurlDate= MAXX(AllSELECTED (Score_GAD7),Score_GAD7[GAD.session_date])

 

If it doesn't meet your requirement, kindly share your sample data and excepted result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.

 

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

View solution in original post

10 REPLIES 10
amitchandak
Super User
Super User

you can try like this

 

 if(c=0,"Not available",if(A1-A>=6  || B1-B>=4,"YES","NO"))

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.

My Recent Blog - https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks, Can you help me look at the second dax function? @amitchandak 

Try

IF(C=0,"Not available",If((B1>=8 || A1>=10) && (B1<8 && A1<6) , "Yes","No"))

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.

My Recent Blog - https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank you. The last question. If want to add another conditions.  If  B1<8 and A1<10 show "Start below caselevel"

Can you help me add to your dax function? I also provide mine, which gave error can you help me look at it:   @amitchandak 

 

IF(HASONEFILTER('Cases'[name]),
IF(
   BaseLineActualDate=BaseLineBaseDate,
  "Not available",
IF(
    BaseLineBaseValue_GAD<8 & BaseLineBaseValue_PHQ<10,
   "Start below casesness",
      If(
        BaseLineActualValue_GAD<8& BaseLineActualValue_PHQ<10,
      "Yes",
       "No")
      )
),
"--"
)

what is the error you are getting?

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi @amitchandak :

The error is the data is not correct: please see my below function:

Actually, my Sincebaseline_GAD is 9(which is bigger than 4), which shold gave "Yes" result, but the result here show "No", I checked the raw data, The  sincebaseline_GAD using my function below show -17... Can you help me check which part is wrong? The filter I am using is in case table. Thanks

 

 

question.JPG

Hi @xiumi_hou ,

 

Please update the formulas of  BaseLineBaseDate and BaseLineActurlDate as below to check again.

BaseLineBaseDate = MINX(AllSELECTED (Score_GAD7),Score_GAD7[GAD.session_date])
BaseLineActurlDate= MAXX(AllSELECTED (Score_GAD7),Score_GAD7[GAD.session_date])

 

If it doesn't meet your requirement, kindly share your sample data and excepted result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.

 

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

Thank you so much @v-frfei-msft 

UP @amitchandak 

JonV
Helper II
Helper II

Here's the general format:

 

Measure = IF(C = 0, "Not Available",
IF(OR(A1 - A >= 6, B1 - B >= 4) = TRUE, "Yes", "NO)

 

There's no way to get the Nulls in this unless there's more logic steps I'm missing.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.