Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
I have data as below -
i want to create a logic which will show cumulative sum like below
Jan - 30
Feb - Jan + 20
Mar - Jan +Feb+ 50
Apr - Jan +Feb + Mar +20
Hi, @Alice08
Thanks for the reply from @PijushRoy, @suparnababu8 and @ryan_mayu. You can refer to their methods or try using following dax to achieve your need.
Cumulative Value =
VAR _year = SELECTEDVALUE('Table'[Year])
VAR _re =
CALCULATE(
SUM('Table'[Value]),
FILTER(
ALLSELECTED('Table'),
'Table'[Year] = _year &&
'Table'[Month] <= MAX('Table'[Month])
)
)
RETURN
_re
Best Regards,
Yang
Community Support Team
If 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 in the Power BI Forum
Hi @Alice08
Please find the solution below.
For example, the fiscal year start date is 1st April. In my solution no data for Jan Feb March, so as cumulative showing total number
The calendar table is marked as Date Table in the model
Please change the dax as per your data model.
CumulativeSales =
VAR SelectedDate = MAX('Calendar'[Date])
VAR FiscalYearStart = DATE(YEAR(SelectedDate) - IF(MONTH(SelectedDate) < 4, 1, 0), 4, 1)
VAR YTD_Calculation =
CALCULATE(
SUM(Sales_Invoice[Invoice Value]),
FILTER(
ALL('Calendar'),
'Calendar'[Date] >= FiscalYearStart && 'Calendar'[Date] <= SelectedDate
)
)
RETURN
YTD_Calculation
Please let me know
Proud to be a Super User! | |
could you pls provide some sample data?
Proud to be a Super User!
Sample data
you don't have the date column in your data? It's better to have a date column
then create a column
Proud to be a Super User!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
90 | |
82 | |
65 | |
51 | |
31 |
User | Count |
---|---|
117 | |
116 | |
71 | |
64 | |
46 |