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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
zahrabajgiran
Regular Visitor

using average and SUM

INVOICESTEPINVOICEDATETASKENDTIMEDAYSSPENT
22093CProcess Invoice2022-04-2941:00.05
22093CSuper Approval2022-04-2914:00.037
22093CGL Stamp Job/Subcontractor2022-04-2941:00.00
22093CFinal Approval2022-04-2941:00.00
22093CPM Approval2022-04-2921:00.00
22093CVP Approval2022-04-2922:00.00
22093CInvoice Coder Not Found2022-04-2910:00.00
22113HBProcess Invoice2022-05-1752:00.093
22113HBVP Approval2022-05-1731:00.07
22113HBSuper Approval2022-05-1748:00.028
22113HBFinal Approval2022-05-1709:00.00
22113HBGL Stamp Job/Subcontractor2022-05-1753:00.00
22113HBPM Approval2022-05-1755:00.028

 

Hello everybody, 

I am new to DAX and I searched a lot for my question but I was not successful to get an answer. 

I put my table here. 

I want to have a new coloumn which shows me the SUM of DAYSSPENT on unique INVOICE numbers, and then I want to be able to have an AVERAGE of those SUM.

1 ACCEPTED SOLUTION
barritown
Super User
Super User

Hi @zahrabajgiran,

barritown_0-1685710521742.png

If the columns on the screenshot above match your expectations, you can achieve such results using two similar calculated columns:

SUM_DAYSSPENT = 
VAR CurrentInvoice = [INVOICE]
RETURN SUMX ( FILTER ( ALL(data), [INVOICE] = CurrentInvoice ), [DAYSSPENT] )

AVG_DAYSSPENT = 
VAR CurrentInvoice = [INVOICE]
RETURN AVERAGEX ( FILTER ( ALL(data), [INVOICE] = CurrentInvoice ), [DAYSSPENT] )

Best Regards,

Alexander

My YouTube vlog in English

My YouTube vlog in Russian

 

View solution in original post

1 REPLY 1
barritown
Super User
Super User

Hi @zahrabajgiran,

barritown_0-1685710521742.png

If the columns on the screenshot above match your expectations, you can achieve such results using two similar calculated columns:

SUM_DAYSSPENT = 
VAR CurrentInvoice = [INVOICE]
RETURN SUMX ( FILTER ( ALL(data), [INVOICE] = CurrentInvoice ), [DAYSSPENT] )

AVG_DAYSSPENT = 
VAR CurrentInvoice = [INVOICE]
RETURN AVERAGEX ( FILTER ( ALL(data), [INVOICE] = CurrentInvoice ), [DAYSSPENT] )

Best Regards,

Alexander

My YouTube vlog in English

My YouTube vlog in Russian

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

August Carousel

Fabric Community Update - August 2024

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