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.
I want to show hires for our office each month, and then to have the previous months hire total added to the next month to get a cummulative by month count of the hires. I need this to run from an Oct 1st start to a Sept 30th end (already created a date table for this)
For example in Oct we hired 30 people, then in Nov we hired 25 people the dot (or line) for Nov would be at 55, for Dec we hired 10 people so the total for Dec would be 65, etc to January.
Right now I have my code as
Solved! Go to Solution.
Hi @Nepal101
Thanks for being patient with me. That correction still didn't result in a cummulative Month over month. I cannot attach the PBIX due to other PII information but have attached the snippet of the data which I am using in Excel in hopes this can help
Hi @lem5072
Try this if I understood your question, the filter restricts the dates to start at October, and go through cur date. That is why I included Sept to illustrate where it starts.
Running Total =
var _today = TODAY()
var _startingDate = IF(MONTH(_today)>9, DATE(YEAR(_today),10,1),DATE(YEAR(_today)-1,10,1))
var _curDate = MAX(TableMine[Date])
var _sumHired = SUM(TableMine[Hired])
var _calc = CALCULATE([Sum of Hired],FILTER(ALL(TableMine),TableMine[Date]>=_startingDate && TableMine[Date]<=_curDate)
)
return _calc
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel
Proud to be a Super User!
Hi @Nathaniel_C
I am still getting a return of the months total count not the cummulative sum. If I am using the _sumHired as a count function of persons dates do you think that needs to be changed to a sum function of something else to work?
Hi @lem5072 ,
Sorry, I did not include that
Sum of Hired = SUM(TableMine[Hired])
Sometimes for a quick return, you know.😀
When you post a picture or use words, I create a table instead of actual data. Better to provide a pbix.
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel
Proud to be a Super User!
HI @Nathaniel_C
Thanks for being patient with me. That correction still didn't result in a cummulative Month over month. I cannot attach the PBIX due to other PII information but have attached the snippet of the data which I am using in Excel in hopes this can help
https://docs.google.com/spreadsheets/d/18pquWJFGEz14BIEKBDiw_hS4QsvPWhC48zj0-Aqv-gQ/edit?usp=sharing
Hi @lem5072 ,
Your question "My issue now is how would i not show any data for months that have not occurred yet? " This will be solved by adding the IF() at the RETURN line. I also added comments that should make it easier to follow along.
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel
Running Total =
VAR _today = //get today'date
TODAY ()
VAR _startingDate = //make the date that you wish to start
IF (
MONTH ( _today ) > 9,
DATE ( YEAR ( _today ), 10, 1 ),
DATE ( YEAR ( _today ) - 1, 10, 1 )
)
VAR _curDate = //get the date of the current row
MAX ( TableMine[Date] )
VAR _calc = //Do the running total
CALCULATE (
[Sum of Hired],
FILTER (
ALL ( TableMine ),
TableMine[Date] >= _startingDate
&& TableMine[Date] <= _curDate
)
)
RETURN //if today is greater than current date, return the _calc otherwise make it blank. Any days previous to the starting date are alreadynot included
IF ( _today > _curDate, _calc, BLANK () )
Proud to be a Super User!
hi @Nepal101
I am still not getting a cummulative count for each month
Hello @lem5072
Instead of using the sum can you use the distinct count in your formula.
Thank you
When I use DistinctCount it returns a value of 1 for each month (because I index the count of persons (since people have historically shared names and there is not person centric unique identifier in the dataset)
I tried using the Index and if you create a measure using the index column you can achieve the value. Please try. Creating the first measure using the index column and then using the same measure in creating the second measure.
Can you count the hire date that will give you the count in total and use that in the formula?
Hi @Nepal101
Thanks for being patient with me. That correction still didn't result in a cummulative Month over month. I cannot attach the PBIX due to other PII information but have attached the snippet of the data which I am using in Excel in hopes this can help
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
99 | |
83 | |
70 | |
60 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |