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

Calculate new measure based on values from two columns

Hi all,

 

Each month, I have the Year-to-Date amount that was spent. I would like to calculate the amount spent in a specific month. I am creating a dashboard which will allow the user to filter based on month. 

 

My data looks like this:

NameMonthYTD Spent
MichaelJanuary100
LauraJanuary200
LionelJanuary150
MichaelFebruary100
LauraFebruary500
LionelFebruary200

 

 

I would like it to look this: 

 

NameMonthYTD SpentMonthly Spent
MichaelJanuary100 
LauraJanuary200 
LionelJanuary150 
MichaelFebruary1000
LauraFebruary500300
LionelFebruary20050

 

This way, for example in the month of February, users can see how much was spent just in February.

 

Thanks in advance!

 

Best regards.

 
 
2 ACCEPTED SOLUTIONS

Hi @khans9 ,

 

I would solve it with Power Query.

 

1. Generate the Month No with a Conditional Column

M_Month_No.png

 

2. Subtract 1 from the Month No, to get the Previous Month No

M_Prev_Month_No.png

 

3. Merge Queries as new (Self-Join Name & Prev Month No --> Name & Month No)

M_Merge.png

 

4. Expand an get the previous YTD Spent

M_Expand.png

 

5. Subtract YTD Spent with previous YTD Spent

M_Subtract.png

 

6. Rename the Column

M_Rename.png

 

 

If I answered your question, please mark my post as solution, this will also help others.

Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


View solution in original post

dax
Community Support
Community Support

Hi khans9, 

You could refer to my sample for details. If this is not what you want, please correct me and inform me more detailed information.

Best Regards,
Zoe Zhi

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

3 REPLIES 3

Hi @khans9 ,

 

did you solve your problem?


If I answered your question, please mark my post as solution, this will also help others.

Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


dax
Community Support
Community Support

Hi khans9, 

You could refer to my sample for details. If this is not what you want, please correct me and inform me more detailed information.

Best Regards,
Zoe Zhi

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

Hi @khans9 ,

 

I would solve it with Power Query.

 

1. Generate the Month No with a Conditional Column

M_Month_No.png

 

2. Subtract 1 from the Month No, to get the Previous Month No

M_Prev_Month_No.png

 

3. Merge Queries as new (Self-Join Name & Prev Month No --> Name & Month No)

M_Merge.png

 

4. Expand an get the previous YTD Spent

M_Expand.png

 

5. Subtract YTD Spent with previous YTD Spent

M_Subtract.png

 

6. Rename the Column

M_Rename.png

 

 

If I answered your question, please mark my post as solution, this will also help others.

Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


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.