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

Summing values of one column and comparing it to a column from another table - Direct Query

Hi, first of all, I'm using the Direct Query mode and my trouble concerns these two tables:

First Table contains the Dates, Teams, Activities and Price of each actitivity that was executed (the sum is the daily productivity).

marciofilho_0-1676568843215.png

 

The Second Table is a helper table that contains Dates, Teams and the Daily Goal ($) to achieve (it varies accordingly with the day of the week).

marciofilho_1-1676568947803.png

 

My purpose is quite simple, actually, i just want to SUM the values of the column preco_a_cobrar (productivity) and compare this value to the values  of meta_diaria (daily goal).

 

As I said, I'm using the Direct Query Mode and the intrinsic limitation is the reason of my struggling.

Can someone, please, help?

 

Best Regards,

Marcio.

2 REPLIES 2
Anonymous
Not applicable

(Generated from Chat Gpt)

To compare the sum of the productivity (preco_a_cobrar) to the daily goals (meta_diaria), you can use a measure in Power BI. Here's an example measure that calculates the total productivity for a selected date and team

Total Productivity =
CALCULATE(
SUM('Table 1'[preco_a_cobrar]),
ALLEXCEPT('Table 1', 'Table 1'[Data], 'Table 1'[Equipe])
)


This measure uses the CALCULATE function to sum the values in the preco_a_cobrar column for a selected date and team. The ALLEXCEPT function removes any filters on the Data and Equipe columns, so that the calculation is based only on the selected date and team.

To compare the total productivity to the daily goal, you can create another measure that calculates the difference between the two values

Productivity vs. Goal = [Total Productivity] - MIN('Table 2'[meta_diaria])


This measure subtracts the daily goal (from Table 2) from the total productivity (calculated by the previous measure). The MIN function is used to get the daily goal value for the selected date and team.

You can then create a visual that shows the daily goal and the total productivity, and use the second measure to show the difference between the two values. For example, you could create a clustered column chart with the date on the X-axis, the daily goal and total productivity as separate values in the Values field, and the Productivity vs. Goal measure as a secondary value in the same field.

 

 

 

 

Anonymous
Not applicable

Hi, I really appreciate your answer but, unfortunately, this solution didn't help much. I thought about using a MAX/MIN but I forgot to mention that I also need to SUM the values of the meta_diaria (daily goal) because I want to  add a slicer with the Dates so the values can be changed dinamically.

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