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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Power Bi Dax create table from other tables and measure

Hi I'm pretty new to Power Bi, and am wondering if anyone can help on the issue below? I'm struggled for more than 2 weeks and still couldn't figure out how to do it.  Thanks

 Table "Adviser"

Adviser KeyAuthority
1A
2B
3C
4B
5A

 

Table "Practice"

Adviser keyPractice keyPractice group keyPractice group name

 

How can I use Dax to create a table like below

Practice group nameNo. of advisers with Authority "A"No. of advisers with Authority "B"

 

The relationship between table "practice" and table "adviser" is Many to One, linked by adviser key

1 ACCEPTED SOLUTION

@Anonymous 

you can create two measures.

No.ofA = CALCULATE(DISTINCTCOUNT(Adviser[Adviser Key]),FILTER(Adviser,Adviser[Authority]="A"))

No.ofB = CALCULATE(DISTINCTCOUNT(Adviser[Adviser Key]),FILTER(Adviser,Adviser[Authority]="B"))

1.PNG

if you want to create a table, you can try this

 

Table = SUMMARIZE('Practice',Practice[Practice group key],"NO. of A",CALCULATE(DISTINCTCOUNT(Adviser[Adviser Key]),FILTER(Adviser,Adviser[Authority]="A")),"NO.of B",CALCULATE(DISTINCTCOUNT(Adviser[Adviser Key]),FILTER(Adviser,Adviser[Authority]="B")))

pls see the attachment below.





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

Proud to be a Super User!




View solution in original post

9 REPLIES 9
TomMartens
Super User
Super User

Hey @Anonymous, 

 

I'm not recommending to create a 3rd table, from my understanding of your requirement it will be sufficient to create two measures.

Assuming the relationships between your two tables looks like this:

image.png

Then you can create two measures like so:

Advisors with A = 
COUNTROWS(
    FILTER(
        CALCULATETABLE(
            'Advisor'
            , CROSSFILTER( 'Advisor'[Adviser Key] ,Practice[Adviser key] , Both )
        )
        , 'Advisor'[Authority] = "A"
    )
)

and so

Advisors with B = 
COUNTROWS(
    FILTER(
        CALCULATETABLE(
            'Advisor'
            , CROSSFILTER( 'Advisor'[Adviser Key] ,Practice[Adviser key] , Both )
        )
        , 'Advisor'[Authority] = "B"
    )
)

This lets you create a visual using the Table visual like so

TomMartens_0-1648102334818.png

I highly recommend reading through this tutorial about data modeling in Power BI: https://docs.microsoft.com/en-us/learn/paths/model-power-bi/?WT.mc_id=DP-MVP-5003068

This article explains how you can create a measure: https://docs.microsoft.com/en-us/power-bi/transform-model/desktop-measures?WT.mc_id=DP-MVP-5003068

 

Hopefully, this helps to tackle your challenge.

Regards,
Tom

P.S.: Enjoy your Power BI journey, from my personal experience i can tell that there is more joy than tears 🙂

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
Anonymous
Not applicable

Hi Tom, I have to create a table for the further calculation, but your measures worked on my report. Thanks anyway. 

ryan_mayu
Super User
Super User

@Anonymous 

could you pls provide the sample data of table practice and the expected output?





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

Proud to be a Super User!




Anonymous
Not applicable

Hi Ryan,

Please find my tables below

 

Table"Adviser"

Adviser KeyAuthority
A01A
A02B
A03A
A04B
A05A
A06B
A07A
A08A


Table "Practice"

Adviser keyPractice keyPractice group key
A01P001G1
A02P002G1
A03P003G2
A04P004G2
A05P001G1
A06P002G1
A07P003G2
A08P004G2

 

Expected Output

Practice group nameNo. of advisers with Authority "A"No. of advisers with Authority "B
G122
G231

@Anonymous 

you can create two measures.

No.ofA = CALCULATE(DISTINCTCOUNT(Adviser[Adviser Key]),FILTER(Adviser,Adviser[Authority]="A"))

No.ofB = CALCULATE(DISTINCTCOUNT(Adviser[Adviser Key]),FILTER(Adviser,Adviser[Authority]="B"))

1.PNG

if you want to create a table, you can try this

 

Table = SUMMARIZE('Practice',Practice[Practice group key],"NO. of A",CALCULATE(DISTINCTCOUNT(Adviser[Adviser Key]),FILTER(Adviser,Adviser[Authority]="A")),"NO.of B",CALCULATE(DISTINCTCOUNT(Adviser[Adviser Key]),FILTER(Adviser,Adviser[Authority]="B")))

pls see the attachment below.





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

Proud to be a Super User!




Anonymous
Not applicable

Thanks so much Ryan, this is exactly what I want. You solved my 2 weeks nightmare. 

you are welcome





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

Proud to be a Super User!




Anonymous
Not applicable

@amitchandak Thanks for your advise. I'm pretty new to PowerBI, could you please give me an example about how to write the Dax?

amitchandak
Super User
Super User

@Anonymous , Merge in power query.

 

Summarize in DAX can work as these are joined tables you can select many table in table and then can use another table.

 

Or you can also check Natural joins

https://www.sqlbi.com/articles/from-sql-to-dax-joining-tables/

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

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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