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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
Anonymous
Not applicable

INTERSECT over 2 CALCULATED Tables

As a newbie I am stuck on this one for hours now not knowing why it won't work. I am trying to create a new column like below, but I get an error:  The expression contains multiple columns, but only a single column can be used in a True/False expression that is used as a table filter expression. Can someone tell me where do I have multiple columns?

 

 

Expired =
VAR __ProposedIds = SELECTCOLUMNS(CALCULATETABLE(
ReportData,
ReportData[Event] = "Proposed" && ReportData[Consumer.CompanyGuid] = Consumer[CompanyGuid]
), "Ids", [LeadId])
VAR __ExpiredIds = SELECTCOLUMNS(CALCULATETABLE(
ReportData,
ReportData[Event] = "Expired"
), "Ids", [LeadId])

RETURN COUNTROWS( INTERSECT(__ProposedIds, __ExpiredIds)) + 0

 

I have a table ReportData with many Columns (Event, CompanyGuid etc..) I have another table Consumer where I am creating additional columns. What I want is a count of Expired events from ReportData table. That is for a given LeadId if there exists an Event Expired and also an Event Proposed with Conusmer.CompayGuid being that of Consumer table CompanyGuid. 

3 REPLIES 3
V-pazhen-msft
Community Support
Community Support

@Anonymous 
I not sure why you used Selectedcolumns, It seems you wanted to [leadid] in addition to the var tables. But it looks like the LeadId is already in the report data table. Try your dax without selectedcolumns.

 

Expired =
VAR __ProposedIds=CALCULATETABLE(ReportData,ReportData[Event] = "Proposed" && ReportData[Consumer.CompanyGuid] = Consumer[CompanyGuid])
VAR __ExpiredIds=CALCULATETABLE(ReportData,ReportData[Event] = "Expired")

RETURN COUNTROWS( INTERSECT(__ProposedIds, __ExpiredIds)) + 0

 

 Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

parry2k
Super User
Super User

@Anonymous what is the relationship between ReportData with Consumer table and the issue is with this expression

 

&& ReportData[Consumer.CompanyGuid] = Consumer[CompanyGuid]

 

Not sure why you are doing this. I would recommend to share some sample data and expected output.

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

@parry2k 

Yes the issue seems to be there, because if I remove the AND condition then I get 0 as my value. ReportData is a new table which is the result of a LEFT JOIN of another table and Consumer table. Now I am extending the Consumer table with new columns. Any tips?

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

Check out the March 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors
Top Kudoed Authors