The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello,
I would like to build cumulative line value for below chart.
I have plan for all month for example its 2400min in December I have 18 working days so 2400/18 = 133,33 daily.
I would like to build line that show me cumulative at the next days so 1 day will be 133,33 2 day will be 266,66 etc.
How can I do this ? 🙂
Solved! Go to Solution.
HI @ToKo ,
Did your table contain the original amount field? I'd like to suggest you use the following measure formula with original amount fields:
Measure =
VAR currDate =
MAX ( 'Table'[Date] )
VAR dateRange =
CALCULATETABLE (
VALUES ( 'Table'[Date] ),
FILTER (
ALLSELECTED ( 'Table' ),
YEAR ( [Date] ) = YEAR ( currDate )
&& MONTH ( [Date] ) = MONTH ( currDate )
)
)
VAR total =
CALCULATE (
SUM ( 'Table'[Amount] ),
FILTER (
ALLSELECTED ( 'Table' ),
YEAR ( [Date] ) = YEAR ( currDate )
&& MONTH ( [Date] ) = MONTH ( currDate )
)
)
VAR duration =
DATEDIFF ( MINX ( dateRange, [Date] ), MAXX ( dateRange, [Date] ), DAY )
RETURN
total / duration
* DATEDIFF ( MINX ( dateRange, [Date] ), currDate, DAY )
Regards,
Xiaoxin Sheng
@parry2k I have one table with cumulative sum for each line and AvrageForLine for this i would like to build cumulative avrage line for chart.
Line | Date | CumulativeSum | AvrageForLine |
1111 | 2019-12-01 | 34 | 28 |
1112 | 2019-12-01 | 50 | 44 |
1113 | 2019-12-01 | 70 | 65 |
1111 | 2019-12-02 | 50 | 28 |
1112 | 2019-12-02 | 80 | 44 |
1113 | 2019-12-02 | 100 | 65 |
1111 | 2019-12-03 | 80 | 28 |
1112 | 2019-12-03 | 120 | 44 |
1113 | 2019-12-03 | 150 | 65 |
1111 | 2019-12-04 | 110 | 28 |
1112 | 2019-12-04 | 160 | 44 |
1113 | 2019-12-04 | 190 | 65 |
HI @ToKo ,
Did your table contain the original amount field? I'd like to suggest you use the following measure formula with original amount fields:
Measure =
VAR currDate =
MAX ( 'Table'[Date] )
VAR dateRange =
CALCULATETABLE (
VALUES ( 'Table'[Date] ),
FILTER (
ALLSELECTED ( 'Table' ),
YEAR ( [Date] ) = YEAR ( currDate )
&& MONTH ( [Date] ) = MONTH ( currDate )
)
)
VAR total =
CALCULATE (
SUM ( 'Table'[Amount] ),
FILTER (
ALLSELECTED ( 'Table' ),
YEAR ( [Date] ) = YEAR ( currDate )
&& MONTH ( [Date] ) = MONTH ( currDate )
)
)
VAR duration =
DATEDIFF ( MINX ( dateRange, [Date] ), MAXX ( dateRange, [Date] ), DAY )
RETURN
total / duration
* DATEDIFF ( MINX ( dateRange, [Date] ), currDate, DAY )
Regards,
Xiaoxin Sheng
@ToKo there are many ways to achieve this, it is important to know how your data looks like to provide the appropriate solution. Can you share sample data here?
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
User | Count |
---|---|
78 | |
74 | |
42 | |
32 | |
28 |
User | Count |
---|---|
104 | |
93 | |
52 | |
50 | |
46 |