Forum Discussion
Counting rows
- Anonymous3 years ago
Hi Zeesh1979 ,
I made a simple file, please check the model:Total Sales = VAR _month = SELECTEDVALUE('Calendar'[Month]) VAR _total = CALCULATE(SUM('SalesTable'[Sales]),FILTER('SalesTable',_month>MONTH('SalesTable'[Date]))) + 0 RETURN _totalBest Regards,
Gao
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data
| Item | Sales | Month |
| Cars | 100 | Jan |
| Bikes | 150 | Feb |
| Cars | 50 | Jan |
| Bikes | 120 | March |
expected output if March filter selected
| Total Sales | 300 |
expected output if Feb filter selected
| Total Sales | 150 |
i hope this helps more...(im new to community and learning how to improve asking question)
Zeesh1979 Yeah, you are really going to want an actual Date column in there otherwise it's going to get really ugly to code because there is no way to numerically figure out "before" and thus you would end up hand coding all of your month values. Super ugly. You could possibly get away with a numeric Month column, 1, 2, 3, 4, etc. if you don't care about years.