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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
DGodQc
Frequent Visitor

Unable to retrieve a value with conditions

Hi all,

 

I'm trying to retrieve the good price for a specific Item in our Database. We have a Price_break table with Effective_Date and Deactive_Date.  I'm trying to create a lookupvalue with a filter, but i'm stuck.

breaks1.png

For a Item(ARINVT), i need to select the correct price for the currentday.  I've created a column with today's date in order to that(Probably can do it automatically in a formula, but i don't know yet how).

I have created a measure, but the output is not what i'm looking for.

 

PrixCOnv = calculate(
SELECTEDVALUE ( ARINVT_BREAKS[PrixConverti] );
FILTER (
ARINVT_BREAKS;(AND(ARINVT_BREAKS[EFFECT_DATE]<ARINVT_BREAKS[Today];or(ARINVT_BREAKS[DEACTIVE_DATE]>ARINVT_BREAKS[Today];(ARINVT_BREAKS[DEACTIVE_DATE]=blank()))))))
 
I've tried a calculatedcolumn with a lookupvalue, and i have problems with the filters.
Prixconve = LOOKUPVALUE( ARINVT_BREAKS[PrixConverti];ARINVT_BREAKS[ARINVT_ID];ARINVT[ID] )
FILTER (
ARINVT_BREAKS;(AND(ARINVT_BREAKS[EFFECT_DATE]<ARINVT_BREAKS[Today];or(ARINVT_BREAKS[DEACTIVE_DATE]>ARINVT_BREAKS[Today];(ARINVT_BREAKS[DEACTIVE_DATE]=blank()))))))
 
Thanks in advance for your advice!
Dany
 

 

1 ACCEPTED SOLUTION
v-xicai
Community Support
Community Support

Hi @DGodQc ,

 

From your description, you want to create a measure or column to get ARINVT_BREAKS[PrixConverti] while complying with specific conditions( one condition is

ARINVT_BREAKS[ARINVT_ID]=ARINVT[ID] , the other is to filter date),it is right? If yes, you can create a column using DAX below, readjust the formula to make it effective.

 

PrixCOnv = CALCULATE(SELECTEDVALUE ( ARINVT_BREAKS[PrixConverti] ),

           FILTER (ARINVT_BREAKS,             AND(ARINVT_BREAKS[EFFECT_DATE]<ARINVT_BREAKS[Today],or(ARINVT_BREAKS[DEACTIVE_DATE]>ARINVT_BREAKS[Today],ARINVT_BREAKS[DEACTIVE_DATE]=blank()))

&&ARINVT_BREAKS[ARINVT_ID]=ARINVT[ID] ))

 

Or you can share your sample data or screenshots for further analysis, upload sample pbix to OneDrive and post the link here. Do mask sensitive data before uploading.

 

Best Regards,

Amy

 

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

2 REPLIES 2
v-xicai
Community Support
Community Support

Hi  @DGodQc ,

 

Does that make sense? If so, kindly mark my answer as a solution to help others having the similar issue and close the case.

 

Best regards

Amy Cai

v-xicai
Community Support
Community Support

Hi @DGodQc ,

 

From your description, you want to create a measure or column to get ARINVT_BREAKS[PrixConverti] while complying with specific conditions( one condition is

ARINVT_BREAKS[ARINVT_ID]=ARINVT[ID] , the other is to filter date),it is right? If yes, you can create a column using DAX below, readjust the formula to make it effective.

 

PrixCOnv = CALCULATE(SELECTEDVALUE ( ARINVT_BREAKS[PrixConverti] ),

           FILTER (ARINVT_BREAKS,             AND(ARINVT_BREAKS[EFFECT_DATE]<ARINVT_BREAKS[Today],or(ARINVT_BREAKS[DEACTIVE_DATE]>ARINVT_BREAKS[Today],ARINVT_BREAKS[DEACTIVE_DATE]=blank()))

&&ARINVT_BREAKS[ARINVT_ID]=ARINVT[ID] ))

 

Or you can share your sample data or screenshots for further analysis, upload sample pbix to OneDrive and post the link here. Do mask sensitive data before uploading.

 

Best Regards,

Amy

 

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

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.

Top Solution Authors