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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

Conditional Sum based on dates, custom month input

I see posts like these, but this is beyond my skill level and I hope someone would help me with my case. 

 

I want to create four sums:

if transaction date this year then sum

if transaction date last year then sum

if trx date this august then sum

if trx date last year August then sum.

 

All this should be shows per category I have.

 

For the future, I want also be able to create input field with month I want to sum up : e.g. Septemer etc. How can I do this?

 

Should I use measures for this? 

 

Thanks a lot for help!

5 REPLIES 5
CoreyP
Solution Sage
Solution Sage

I'm not sure I fully understand without seeing some sample data. However, if you create a date dimension table and establish a relationship to the date column on your transaction table, you should just be able to use a simple SUM measure on the value column.

Anonymous
Not applicable

Screenshot 2023-09-20 at 08.52.07.png

@CoreyP  thanks a lot, this is a sample data.  Imanaged to use measures and sum up the valued if between certain dates, but my question is, where it says Aug22 and 23, the dates are hardcoded, so datesbetween 0801 and 0831. How can I create a button or something which would be input to that? e.g. I select April and these dates get recalculated for the month I selected?

I hope it makes sense

Please share what your raw data looks like. 

Anonymous
Not applicable

@CoreyP  It is something like the following, a standard tabular

marzwrob_0-1695311620210.png

 

@Anonymous , 
Okay, yeah. So, create a date dimension table and set up the relationship to your created date column. Then create measures to sum whichever value column(s) you want. Then when you build your visuals, you can apply the date hierarchy for whatever granularity you wish. 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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