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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Using a column from another Table

Hi everyone, 

 

I'm trying to use two rather simple table to make a report, here is the steps I've done so far after loading my data:

1- set a relation between two tables (Between: Tableau2['fournisseur + month'] and Qtité_livré[Fourn. & Month])

mohamed_ch12_0-1640016170570.png

 2- Create a measure calculated using both tables:  

NQ (ppm) = COUNT([Date de récéption de l'IC]) / calculate(sum('Qtité_livré'[Nbre de commandes])) * 1000000
 
3- While trying to vizulise my data i got this problem: 
 my new mesure (NQ (ppm)) isn't calculated the way I want it to be
mohamed_ch12_1-1640016359887.png

And due to the fact that it's using the sum of "Nbre de commandes" across the Table 'Qtité_livré' instead of using it in its context 

To be more clear, I get the right values when i add the column 'Qtité_livré'[Fourn.. & Month] to the table above ===> 'Qtité_livré'[Fourn.. & Month] being the right context to this mesure

 

mohamed_ch12_2-1640016657009.png

 

Thank you for your help in advance

 
1 ACCEPTED SOLUTION

Hi @Anonymous 

I thought DAX could not handle this situation, but after I studied your data structure again, I found that DAX can still handle it. 

The principle of DAX is to take the intersection with the red part in the figure, and then sum it.

vxiaotang_0-1640315381022.png

Dax code:

test = //measure
    var _t1= SELECTCOLUMNS(FILTER(ALL(Tableau2),Tableau2[Année]=MIN(Tableau2[Année]) && Tableau2[Mois]=MIN(Tableau2[Mois])),"s",Tableau2[fourniseur + month])
return CALCULATE(SUM('Qtité_livré'[Nbre de commandes]),INTERSECT(VALUES('Qtité_livré'[Fourn. & Month]),_t1))

vxiaotang_0-1640315873119.png

 

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

8 REPLIES 8
v-xiaotang
Community Support
Community Support

Hi @Anonymous 

Would you consider using M code?

 

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hello @v-xiaotang , 
I don't mind using it. what d o you have in mind ?

Hi @Anonymous 

I thought DAX could not handle this situation, but after I studied your data structure again, I found that DAX can still handle it. 

The principle of DAX is to take the intersection with the red part in the figure, and then sum it.

vxiaotang_0-1640315381022.png

Dax code:

test = //measure
    var _t1= SELECTCOLUMNS(FILTER(ALL(Tableau2),Tableau2[Année]=MIN(Tableau2[Année]) && Tableau2[Mois]=MIN(Tableau2[Mois])),"s",Tableau2[fourniseur + month])
return CALCULATE(SUM('Qtité_livré'[Nbre de commandes]),INTERSECT(VALUES('Qtité_livré'[Fourn. & Month]),_t1))

vxiaotang_0-1640315873119.png

 

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hello @v-xiaotang , 

Well that does it. Thank you !

Anonymous
Not applicable

Thank you @smpa01  for you response. 

When I tried it (Apply dont't Summarize to "Nbre de commandes"), this is what it shows :

mohamed_ch12_0-1640075191324.png

But I need to have one line with 183 as total (the sum) instead of the 3 lines in blue

smpa01
Community Champion
Community Champion

@Anonymous  is it possible to provide a sample pbix?


========================
Did I answer your question? Mark my post as a solution!
Proud to be a Super User
My Custom Visualization Projects
• Plotting Live Sound: Live Sound
• Beautiful News: Women in Parliament, Energy Mix, Shrinking Armies
• Visual Capitalist: Working Hrs
• Others: Easing Graph, Animated Calendar
MayViz Submissions
• Week 1: View
• Week 2: View
• Week 3: View
• Week 4: View
========================
Anonymous
Not applicable

Hello, 

 

Apparently as a new memeber I cannot share pbix files yet... 

 

Here's a link via Wetransfer: https://we.tl/t-ZzhcS6QdZk

Thanks

smpa01
Community Champion
Community Champion

@Anonymous  try this and see if it helps 

 

apply the following

 

smpa01_0-1640016971436.png

 

on

 

any axis


========================
Did I answer your question? Mark my post as a solution!
Proud to be a Super User
My Custom Visualization Projects
• Plotting Live Sound: Live Sound
• Beautiful News: Women in Parliament, Energy Mix, Shrinking Armies
• Visual Capitalist: Working Hrs
• Others: Easing Graph, Animated Calendar
MayViz Submissions
• Week 1: View
• Week 2: View
• Week 3: View
• Week 4: View
========================

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.