Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreThe FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now
Hello,
I have to calculate a SUM of my new clients between two dates.
- The date I choose from my filter
- The first day of the year of the date I choose from my filter
So for example, the date I choose from my filter is 23/05/2020. So my SUM has to be between 1/01/2020 and 23/05/2020. This SUM doesn't have to include all the dates before 1/01/2020.
So I did something like that:
Solved! Go to Solution.
@MCacc -
Perhaps:
Measure =
VAR __Date = SELECTEDVALUE('Table'[DATE])
VAR __First = DATE(YEAR(__Date),1,1)
RETURN
SUMX(FILTER('Table',[DATE] >= __First && [DATE] <= __Date),[MY_NEW_CLIENTS])
Hi @MCacc ,
You may create measure like DAX below.
Measure =
Var _FilterDate= SELECTEDVALUE( 'TABE'[DATE])
Var _FirstDate= DATE(YEAR ( 'TABE'[DATE]) , 1,1)
Return
CALCULATE(SUM('Table'[MY_NEW_CLIENTS),FILTER(ALLEXCEPT('TABLE', 'TABLE'[CLIENT_TYPE_ID]), 'TABLE'[DATE] >= _FirstDate&&'TABLE'[DATE] <=_FilterDate))
Best Regards,
Amy
Community Support Team _ Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @MCacc ,
You may create measure like DAX below.
Measure =
Var _FilterDate= SELECTEDVALUE( 'TABE'[DATE])
Var _FirstDate= DATE(YEAR ( 'TABE'[DATE]) , 1,1)
Return
CALCULATE(SUM('Table'[MY_NEW_CLIENTS),FILTER(ALLEXCEPT('TABLE', 'TABLE'[CLIENT_TYPE_ID]), 'TABLE'[DATE] >= _FirstDate&&'TABLE'[DATE] <=_FilterDate))
Best Regards,
Amy
Community Support Team _ Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@MCacc , is that not YTD ?
Example
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(('Date'[Date]),"12/31"))
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-Y...
Appreciate your Kudos.
Thank you amitchandak! This worked perfectly for me. I had an excel file that is connceted to power bi and is formatted like a balance sheet so just numbers that need to be summed in order to get the number for the certain month. I also tried one other solution in this post before trying yours and this was the lucky one!
@MCacc -
Perhaps:
Measure =
VAR __Date = SELECTEDVALUE('Table'[DATE])
VAR __First = DATE(YEAR(__Date),1,1)
RETURN
SUMX(FILTER('Table',[DATE] >= __First && [DATE] <= __Date),[MY_NEW_CLIENTS])
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 53 | |
| 40 | |
| 37 | |
| 19 | |
| 18 |
| User | Count |
|---|---|
| 69 | |
| 67 | |
| 34 | |
| 33 | |
| 30 |