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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

different dax query for each row

I have two tables 

 

table 1 

 

id  a   b    c    d  (columns)

1   0   1    1    1  (rows)

2   1   0    1    0  

 

table 2

 

feature  adoption  frequency (columns)

a

b

c

d

 

Now i want to fill adoption column in table 2.  This column will have count of all the "1" from table 1. I need to match column value (feature) from table 2 and column (a) from table 1. 

 

eg adoption for feature 'a' will count of all the rows from column 'a' in table 1 where row value=1.

 

How can I implement this? All the columns in both the tables are calculated columns.   

1 ACCEPTED SOLUTION
v-huizhn-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

I try to reproduce yourscenario and get expected result using the following steps.

1. Right click Table1 -> Edit Query, like the screenshot.

21.PNG

2. Select a,b,c,d column->click Unpivot columns->Close&Apply. You will get the table like the second screenshot below.

1.PNG

22.PNG

3. Create a relationship between Table1 and Table2. More details about creating and management relationship, please review this article.

30.PNG

4. Create a calculated column using the formula, you will get the desired result.

adoption = CALCULATE(COUNT(Table1[Value]),Table1[Value]=1)

24.PNG

If you have other issues, don't hesitate to let me know.

Best Regards,
Angelia

View solution in original post

2 REPLIES 2
v-huizhn-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

I try to reproduce yourscenario and get expected result using the following steps.

1. Right click Table1 -> Edit Query, like the screenshot.

21.PNG

2. Select a,b,c,d column->click Unpivot columns->Close&Apply. You will get the table like the second screenshot below.

1.PNG

22.PNG

3. Create a relationship between Table1 and Table2. More details about creating and management relationship, please review this article.

30.PNG

4. Create a calculated column using the formula, you will get the desired result.

adoption = CALCULATE(COUNT(Table1[Value]),Table1[Value]=1)

24.PNG

If you have other issues, don't hesitate to let me know.

Best Regards,
Angelia

Greg_Deckler
Community Champion
Community Champion

That's pretty nasty. Off the top of my head, maybe a custom column in table 2, something like:

 

IF([Feature] = "a",SUM('table 1'[a]),IF([Feature] = "b",SUM('table 1[b],...

Probably cleaner with a SWITCH statement.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors