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
Euro_PBI_User
Regular Visitor

Sum up dates and multiply them with costs by year

Hi there,

I've been trying to find a measure that can show the following results in a line and clustered chart:

 

3 responses in the year 2020 * € 100,- = € 300,-.  This measure would be:

Saved costs = Calculate([Savings] * 100)  -- after I created the measure 'Savings' to sum up all response dates in the table below. 

 

But what if I want to select all years that have different costs per year, like:

 

3 responses in the year 2020 (€ 100,- per response)  + 4 responses in the year 2021 (€ 118,- per response) + 2 responses in the year 2022 (€ 115,- per response= € 1002,- in total.

 

Is there a way it can recognize the year in the response date, and make the right calculation if I would use a separate table with just the costs and year?

 

I hope somebody can help me. Thank you!

 

YearSaved cost
2020€ 100
2021€ 118
2022€ 115

 

 

Office workers fill in the response date, so the measure shoud recognize how to make the right calculation.

 Response dateSaved costs
 6-6-2020 €      100,00
 17-6-2020 €      100,00
 20-12-2021 €      118,00
 6-4-2021 €      118,00
 27-3-2021 €      118,00
 12-4-2021 €      118,00
 11-4-2021 €      118,00
 3-3-2022 €      115,00
 28-2-2022 €      115,00
5 REPLIES 5
Euro_PBI_User
Regular Visitor

@johnt75 Thank you for the response.

I can't get the one-to-many relationship as you might see in the screenshot below. I've tried so many different ways to get the correct results. It does show a total costs  and a costs per year, but only 2022 is the correct total costs. Any idea how I could correct the model view? Thank you.

 

Euro_PBI_User_3-1674658585088.png

 

 

 

Can you remove the relationships between Tab3 and Tab1 and create a relationship from Tab3[Year] to Calendar[Year] ?

I've followed your last instruction, but it still showed incorrect results. According to a colleague it was caused by my relationship between Sent letters and Date, and he created some other measures. It seems to work, but I still have learn how exactly.

Anyways, thanks again for your help johnt75. 🙂

I also used your measure of course. 🙂
 
Saved Costs = SUMX(
    'Tab1',
    RELATED( 'Tab3'[Saved cost])
)
johnt75
Super User
Super User

Link your Year Cost table to the date table in a one-to-many relationship and then you can create a measure like

Saved Costs = SUMX(
	'Responses',
	RELATED( 'Year Cost'[Saved cost])
)

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.