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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
FMF
Frequent Visitor

Aggregate a column in Table1 based on Match and No Match values from Table 2

Hi,

 

I have two tables that are currently linked (Relationship) as one to many. I want to create DAX measures that will help generate Visual 1 and Visual 2. Any advice on how this can be achieved

Capture.PNG

 

Floyd

1 ACCEPTED SOLUTION
v-rongtiep-msft
Community Support
Community Support

Hi @FMF ,

Please have a try.

Create a measure.

KPI_DAX = 
var result_1= CALCULATE(SUM('Table 1'[KPI]),FILTER(ALL('Table 1'),'Table 1'[Company]=SELECTEDVALUE('Table 1'[Company])&&[Check]="Match"))
var result_2=CALCULATE(SUM('Table 1'[KPI]),FILTER(ALL('Table 1'),'Table 1'[Company]=SELECTEDVALUE('Table 1'[Company])&&[Check]="Not Match"))
var answer = IF([Check]="Match",result_1,result_2)
return answer

11.PNG

Best Regards

Community Support Team _ Polly

 

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

View solution in original post

6 REPLIES 6
v-rongtiep-msft
Community Support
Community Support

Hi @FMF ,

Please have a try.

Create a measure.

KPI_DAX = 
var result_1= CALCULATE(SUM('Table 1'[KPI]),FILTER(ALL('Table 1'),'Table 1'[Company]=SELECTEDVALUE('Table 1'[Company])&&[Check]="Match"))
var result_2=CALCULATE(SUM('Table 1'[KPI]),FILTER(ALL('Table 1'),'Table 1'[Company]=SELECTEDVALUE('Table 1'[Company])&&[Check]="Not Match"))
var answer = IF([Check]="Match",result_1,result_2)
return answer

11.PNG

Best Regards

Community Support Team _ Polly

 

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

Thanks Polly,

 

Please can you share the DAX measure formula for [Check]

FarhanAhmed
Community Champion
Community Champion

See if this calculated column works 

 

_Check = 

Var LinkID='Table'[LinkID]

RETURN 

IF(COUNTROWS(FILTER('Table (2)','Table (2)'[LinkID]=LinkID))>0,"Matched","Not Matched")

 







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

Proud to be a Super User!




FarhanAhmed
Community Champion
Community Champion

Create a calculated column in your Table 1 something like this 

 

and use it in your Table Visual

 

_Check = IF(ISBLANK(RELATED('Table (2)'[LinkID])),"Not Matched","Matched")






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

Proud to be a Super User!




Hi Farhan,

 

Thankyou for the response. However my model is based on DQ. Table 1 is from Google BigQuery and Table 2 is from Postgres. "RELATED" does not work with DQ connections

 

Floyd

FMF
Frequent Visitor

Hi Farhan,

 

COUNTROWS also does not work in DQ connection

 

Floyd

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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