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! Learn more

Reply
ING_BT
Helper I
Helper I

Calculate only IF value in the other table.. Summarize?

Hello, 

 

I'm trying to calculate the sum of Costs, only when a campaign has users. 

 

For that I have these two tables, connected to a join table.

 

The Join table is a distinct of Campaing IDs from Table One. 

Join to Table 1 => Both Direction

Join to Table 2 => One to Many 

 

If I select a whole week (monday to sunday) this is the expected results : 
So, In a table without dates, how can I have the sum of costs only when Users > 0

 

Results
Campaign IDUsersCosts
1455924
2300400

 

Table 1
DateUsersCampagn ID
Monday01
Tuesday01
Wednesday2001
Thursday2501
Friday51
Saturday1502
Sunday1502

 

Table 2
DateCostCampagn ID
Monday501
Tuesday651
Wednesday3231
Thursday5661
Friday351
Saturday2002
Sunday2002

 

Table 3 (join talbe)
Campagn ID
1
2

 

 

Thank you for your help!

 

Best,

Boris

1 ACCEPTED SOLUTION

Hi, @ING_BT 

Yes, you can use function ’USERELATIONSHIP‘ to do it in a neasure.

You need to create a one-to-many  single inactive relationship between table1 and table2.

veasonfmsft_0-1652689473242.png

Then add a new measure 'M_cost' to replace your original filed 'Cost' in your visual table.

M_Cost = CALCULATE(SUM(Table2[Cost]),USERELATIONSHIP(Table1[Date],Table2[Date]),Table1[Users]<>0)

Result:

veasonfmsft_1-1652689593373.png

Best Regards,
Community Support Team _ Eason

View solution in original post

3 REPLIES 3
ING_BT
Helper I
Helper I

Hello Rohit! 

Is there a way to do it in a measure? 
As my model and tables are way more complexe than this, and it doesn't work with many to many relationship like theses ones.

 

Thank you in advance!

Best,

BT

Hi, @ING_BT 

Yes, you can use function ’USERELATIONSHIP‘ to do it in a neasure.

You need to create a one-to-many  single inactive relationship between table1 and table2.

veasonfmsft_0-1652689473242.png

Then add a new measure 'M_cost' to replace your original filed 'Cost' in your visual table.

M_Cost = CALCULATE(SUM(Table2[Cost]),USERELATIONSHIP(Table1[Date],Table2[Date]),Table1[Users]<>0)

Result:

veasonfmsft_1-1652689593373.png

Best Regards,
Community Support Team _ Eason

rohit_singh
Solution Sage
Solution Sage

Hi @ING_BT ,

Please try the following : 

1) Create a calculated table using Table 1 that only has user values > 0

rohit_singh_0-1652190314593.png


2) Modify relationships

rohit_singh_1-1652190345584.png

Table 3 is linked to Table 2 using campaign id
Table 2 is linked to the new calculated table using the date field.

Remove all links to Table 1 (We need to use the calculated table instead)

You should get the below output

rohit_singh_2-1652190508143.png

Hope this helps. Please mark this answer as the solution if it resolves your issue.

Kind regards,


Rohit

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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