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

Lookupvalues with other conditions

Hi community,

I'm trying to figure out a lookupvalue of price column by the matching of Dates an Contract, but filtered by ID (11) and Month (12) funtion in order to give me an outcome that has two conditions. 

My Table A is:

DateContractIDMonthPrice
01-12-2020202111125
01-12-202020202220
03-12-2020202011124
05-12-202020211146

Table B:

DateContract
01-12-20202021
03-12-20202020
05-12-20202021

 

Outcome:

DateContractPrice
01-12-202020215
03-12-202020204

 

Thanks in advance!

 

Cheers,

1 ACCEPTED SOLUTION

Hi @Anonymous 

You can achieve your goal by filter measure or build a calculated table.

Measure:

Measure = IF(MAX('Table A'[Date]) in VALUES('Table B'[Date])&&MAX('Table A'[Month]) =12&&MAX('Table A'[ID])=11,1,0)

Build a table visual by Date column and Price column. Then add measure in filter field and set it show items when value =1.

Result is as below.

1.png

Or you can build a calculated table.

Outcome =
SUMMARIZE (
    FILTER (
        'Table A',
        'Table A'[Date]
            IN VALUES ( 'Table B'[Date] )
                && 'Table A'[Month] = 12
                && 'Table A'[ID] = 11
    ),
    'Table A'[Date],
    'Table A'[Price]
)

Result is as below.

2.png

Best Regards,

Rico Zhou

 

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

3 REPLIES 3
Anonymous
Not applicable

Thanks @amitchandak! the first one should be leaner than the second one, no?

Hi @Anonymous 

You can achieve your goal by filter measure or build a calculated table.

Measure:

Measure = IF(MAX('Table A'[Date]) in VALUES('Table B'[Date])&&MAX('Table A'[Month]) =12&&MAX('Table A'[ID])=11,1,0)

Build a table visual by Date column and Price column. Then add measure in filter field and set it show items when value =1.

Result is as below.

1.png

Or you can build a calculated table.

Outcome =
SUMMARIZE (
    FILTER (
        'Table A',
        'Table A'[Date]
            IN VALUES ( 'Table B'[Date] )
                && 'Table A'[Month] = 12
                && 'Table A'[ID] = 11
    ),
    'Table A'[Date],
    'Table A'[Price]
)

Result is as below.

2.png

Best Regards,

Rico Zhou

 

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

amitchandak
Super User
Super User

@Anonymous , One way is that you create a join beween two by create a new concatenated column

 key = [Date] & [Contract]

 

Second way is to create a date table and contrat table and use date and contract from that table. Join these tables with both the tables

 

Refer: https://www.youtube.com/watch?v=Bkf35Roman8

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

 

https://www.sqlbi.com/articles/the-importance-of-star-schemas-in-power-bi/

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.