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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

How to combine Lookupvalue, If and AND statement.

Hello,

I have a problem that I tried to look for in this discussion as well, but I couldn't find anything that could help me.

 

I would like to create a function that would compare the columns
Uncleansed sales history and Statistical FC LC Lag 1 for the last 6 months.

 

if the condition is true for all 6 rows
Row(index) 0 Uncleansed sales history > Statistical FC LC Lag 1
Row(index) 1 Uncleaned sales history > Statistical FC LC Lag 1
Row(index) 2 Uncleansed sales history > Statistical FC LC Lag 1
Row(index) 3 Uncleansed sales history > Statistical FC LC Lag 1
Row(index) 4 Uncleansed sales history > Statistical FC LC Lag 1
Row(index) 5 Uncleansed sales history > Statistical FC LC Lag 1

 

return "Overforecast last 6 months"

if this condition does not apply to at least one, return me "blank"

 

PBI.PNG


thank you for every answer

1 ACCEPTED SOLUTION
v-yadongf-msft
Community Support
Community Support

Hi @Anonymous ,

 

Your current DAX formula doesn't affect your memory and Ithink you've solved your problem.

 

Best regards,

Yadong Fang

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

View solution in original post

4 REPLIES 4
v-yadongf-msft
Community Support
Community Support

Hi @Anonymous ,

 

Your current DAX formula doesn't affect your memory and Ithink you've solved your problem.

 

Best regards,

Yadong Fang

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

v-yadongf-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please try following DAX:

Column = SWITCH(
    TRUE(),
    'Table'[Index] = 0 &&'Table'[Index] = 1 &&'Table'[Index] = 2 
    && 'Table'[Index] = 3 &&'Table'[Index] = 4 && 'Table'[Index] = 5 
    && 'Table'[Uncleansed sales history] > 'Table'[Statistical FC LC Lag 1],
    "Overforecast last 6 months",
    BLANK())

vyadongfmsft_0-1663056589258.png

 

Best regards,

Yadong Fang

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

Anonymous
Not applicable

Hi About v-yadongf-msft,

 

thank you for your answer, but it is not working. I finally managed to do it, but I had to create too many auxiliary calculated columns where. I'll send you a photos of my process step by step. 

 

As I already wrote above
I would like to create a function that would compare the columns
Uncleansed sales history and Statistical FC LC Lag 1 for the last 6 months.

f the condition is true for all 6 rows
Row(index) 0 Uncleansed sales history > Statistical FC LC Lag 1
Row(index) 1 Uncleaned sales history > Statistical FC LC Lag 1
Row(index) 2 Uncleansed sales history > Statistical FC LC Lag 1
Row(index) 3 Uncleansed sales history > Statistical FC LC Lag 1
Row(index) 4 Uncleansed sales history > Statistical FC LC Lag 1
Row(index) 5 Uncleansed sales history > Statistical FC LC Lag 1

 

return "Overforecast last 6 months"

if this condition does not apply to at least one, return me "blank"

Patrik1994_0-1663073750518.png

so what i did

1. Step)

Patrik1994_1-1663073800878.png

Patrik1994_2-1663073921548.png

2.Step

Patrik1994_3-1663074005058.pngPatrik1994_4-1663074038303.png

3. Step

Patrik1994_5-1663074076017.png

Patrik1994_6-1663074090705.png

 

Is there any way to make it easier and save memory?

Thank you

lbendlin
Super User
Super User

Please provide sanitized sample data that fully covers your issue. https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.