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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Need help on calculated column which relates to multiple rows

Hi all,

 

I am relatively new to Power BI and DAX and I am having some issue with the following data. I would like to find out which relation numbers have ended in the previous year. However, some relation number have received a new license number so they should not be included. 

To illustrate, relation number 1829 had a license number that ended in 31-dec-2017, but they received a new license number. 

The relation number 1444 had a license number that ended in 31-dec-2017 and did not receive a new license number. I would like to filter on those relation number that had their license number ended and did not receive a new one. 

 

License numberRelation numberStarting dateEnding date
9809182901-jan-1031-dec-17
11907182901-jan-1831-dec-30
10023250901-jan-1231-dec-30
8338144401-jan-0831-dec-17
15222389801-jan-1531-dec-32
594498301-jan-0631-dec-15
1488898301-jan-1631-dec-28

 

This is the preferred output:

License numberRelation numberStarting dateEnding dateBroken relation
9809182901-jan-1031-dec-170
11907182901-jan-1831-dec-300
10023250901-jan-1231-dec-300
8338144401-jan-0831-dec-171
15222389801-jan-1531-dec-320
594498301-jan-0631-dec-150
1488898301-jan-1631-dec-280

 

Thanks in advance.

 

Steef

1 ACCEPTED SOLUTION
PattemManohar
Community Champion
Community Champion

@Anonymous Please try this as a "New Column"

 

BrokenFlag = IF(CALCULATE(COUNTROWS(Test157),FILTER(ALL(Test157),Test157[RelationNumber]=EARLIER(Test157[RelationNumber]) && Test157[EndDate] > TODAY()))>0,0,1)

image.png





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




View solution in original post

4 REPLIES 4
v-jiascu-msft
Employee
Employee

Hi @Anonymous,

 

Could you please mark the proper answers as solutions?

 

Best Regards,
Dale

Community Support Team _ Dale
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 all,

 

I am relatively new to Power BI and DAX and I am having some issue with the following data. I would like to find out which relation numbers have ended in the previous year. However, some relation number have received a new license number so they should not be included. 

To illustrate, relation number 1829 had a license number that ended in 31-dec-2017, but they received a new license number. 

The relation number 1444 had a license number that ended in 31-dec-2017 and did not receive a new license number. I would like to filter on those relation number that had their license number ended and did not receive a new one. 

 

License numberRelation numberStarting dateEnding date
9809182901-jan-1031-dec-17
11907182901-jan-1831-dec-30
10023250901-jan-1231-dec-30
8338144401-jan-0831-dec-17
15222389801-jan-1531-dec-32
594498301-jan-0631-dec-15
1488898301-jan-1631-dec-28

 

This is the preferred output:

License numberRelation numberStarting dateEnding dateBroken relation
9809182901-jan-1031-dec-170
11907182901-jan-1831-dec-300
10023250901-jan-1231-dec-300
8338144401-jan-0831-dec-171
15222389801-jan-1531-dec-320
594498301-jan-0631-dec-150
1488898301-jan-1631-dec-280

 

Thanks in advance.

 

Steef

@Anonymous Please refer the solution in the below post 

 

https://community.powerbi.com/t5/Desktop/Need-help-on-calculated-column-which-relates-to-multiple-rows/m-p/575490#





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




PattemManohar
Community Champion
Community Champion

@Anonymous Please try this as a "New Column"

 

BrokenFlag = IF(CALCULATE(COUNTROWS(Test157),FILTER(ALL(Test157),Test157[RelationNumber]=EARLIER(Test157[RelationNumber]) && Test157[EndDate] > TODAY()))>0,0,1)

image.png





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.