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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

I need a dax logic similar to sql logic

a = select org from policy where policy = 123

then 

b = select accno from policy where org in a

then 

select org from policy where acc in b 

i want to apply this logic in dax how can i get this 

the performance should also be good

7 REPLIES 7
lbendlin
Super User
Super User

ok. what have you tried and where are you stuck?

Anonymous
Not applicable

I have tried it like this, its working but the performance impact is huge. I need it much quicker.

selectcolumns(filter(policy,policy[org] in (

selectcolumns(filter(policy,policy[account] in (

selectcolumns(filter(policy,policy[org] in (selectcolumns(filter(policy,policy[number]=123),"org",policy[org]))),"account",policy[account]))),"org",policy[org]))),"policy",policy[policy])

you can implement this easier via REMOVEFILTERS.  It's a standard "filtering up" pattern.

 

Please provide sample data that fully covers your issue.
Please show the expected outcome based on the sample data you provided.

Anonymous
Not applicable

account  orgpol
xa789
zb456
yaa123
zaa101
yzc110
yd111

suppose this is my dataset, It should check from right to left. 

1. for pol= 123 i am fetching all the org  such as "aa" & "ab" as you can see.

2. Now based on org in (aa) i am fetching all accounts  and the result will be y & z

2. Now based on account y & z it should fetch all the pol. such as 456,123,101,111. this is my final result i want.

How is pol 123 linked to org ab ? 

Anonymous
Not applicable

apologies thats a mistake ive corrected now.

Org Pols = 
var o = [  org]
var a = CALCULATETABLE(SUMMARIZE('Table',[account]),ALLSELECTED(),'Table'[  org]=o) 
var b = CALCULATETABLE(SUMMARIZE('Table',[pol]),ALLSELECTED(),a)
return CONCATENATEX(b,[pol],",")

Org Pols is a calculated column

 

lbendlin_0-1686661134414.png

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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