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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
bsz412
Helper III
Helper III

DAX RELATED with a condition

Hi, 

 

I have a 'sales' table where I have years months, and identifer. 

bsz412_0-1657627149374.png

 

A 'ready_list' table is connected to this table: via another table, with one to many relationships: 

bsz412_1-1657627315542.png

the ready_list table looks like this:

bsz412_2-1657627347215.png

the date next to the id shows when the item became ready.

What I would need is a new column in the sales table, with the following logic:

if item was ready in the indicated 'sales' year, regardless of which month the item became ready, the new column (lets call it 'ready') should show "1". 

bsz412_3-1657627761004.png

So in the example above, if item "74490....." is in the ready_list table, and it was ready in 2022 (so it became ready anytime in 2022 or before 2021) then value is "1" else 0.

second line: item "8013....." if this item is in the ready_list table, and it became ready anytime in 2021 or earlier, then value is "1" else 0.

 

How could I do this? I dont think I can add this year condition to the related function

1 ACCEPTED SOLUTION
jcalheir
Solution Supplier
Solution Supplier

Hi

 

I think you can do it with Related function. Try this:

 

Create a calculated column in the sales table with the following formula, and check if the values are correct:

 

Ready date = RELATED(ready_list[month_year])

 

View solution in original post

2 REPLIES 2
v-eqin-msft
Community Support
Community Support

Hi @bsz412 ,

 

Since there are multiple tables, could you provide me with more details about your table in Table/Text format and your problem or share me with your pbix file after removing sensitive data.

Refer to:

How to Get Your Question Answered Quickly - Microsoft Power BI Community

How to provide sample data in the Power BI Forum - Microsoft Power BI Community

 

Best Regards,
Eyelyn Qin

jcalheir
Solution Supplier
Solution Supplier

Hi

 

I think you can do it with Related function. Try this:

 

Create a calculated column in the sales table with the following formula, and check if the values are correct:

 

Ready date = RELATED(ready_list[month_year])

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors