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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Conditionnal Column with a common Key

Hello everyone,

 

I would like to create a condition that says if from a common key (Claim ID) you have an 2 invoices : the first one with an invoice date before 16/03 and another one after 16/03 then = Yes otherwise No. 

 

Could you please help me ? Thank you.

 

WhiteLight_FI_2-1604326677759.png

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous 

I think you want to add a column to show "Yes" if the same Claim ID have hybrid invoices(before 16/03 and after 16/03.) , and others show "No".

You could build a calculated column.

Caculated column = 
VAR _MIN = MINX(FILTER('Table','Table'[Claim ID]=EARLIER('Table'[Claim ID])),'Table'[Invoice Date])
VAR _MAX = MAXX(FILTER('Table','Table'[Claim ID]=EARLIER('Table'[Claim ID])),'Table'[Invoice Date])
Return
IF(_MIN<DATE(2016,03,16)&&_MAX>DATE(2016,03,16),"Yes","No")

Result is as below.

1.png

You can download the pbix file from this link: Conditionnal Column with a common Key

 

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
amitchandak
Super User
Super User

@Anonymous ,

Create a new column

if(format([invoicedate],"MMDD") <= 0306,"Yes","No")

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
Anonymous
Not applicable

Thank you for your answer but actually there is 2 conditions regarding the date. 

 

Exemple :

Claim ID 1717 / Invoice Date : 17/02

Claim ID 1717 / Invoice Date : 27/07

 

There is 2 invoices with the same claims ID but at different Claim Date.

 

And my condition is the following if there is a same a claim ID for x invoices, one BEFORE the 16/03 and one AFTER the 16/03. 

Then, Yes otherwise No. 

 

I would like to be able to estimate how many invoices with the same Claim ID have hybrid invoices i.e. before 16/03 and after 16/03.

 

I hope I am clear, thank you very much for your help.

Anonymous
Not applicable

Hi @Anonymous 

I think you want to add a column to show "Yes" if the same Claim ID have hybrid invoices(before 16/03 and after 16/03.) , and others show "No".

You could build a calculated column.

Caculated column = 
VAR _MIN = MINX(FILTER('Table','Table'[Claim ID]=EARLIER('Table'[Claim ID])),'Table'[Invoice Date])
VAR _MAX = MAXX(FILTER('Table','Table'[Claim ID]=EARLIER('Table'[Claim ID])),'Table'[Invoice Date])
Return
IF(_MIN<DATE(2016,03,16)&&_MAX>DATE(2016,03,16),"Yes","No")

Result is as below.

1.png

You can download the pbix file from this link: Conditionnal Column with a common Key

 

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. 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.