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 everyone,
I'm trying to build a cumulative bar chart, showing the value at each occurence, I think it is not very clear so this a basical example
Shop A | 01/01/2023 | 10 |
Shop B | 12/01/2023 | 8 |
Shop A | 15/01/2023 | 5 |
Shop B | 20/01/2023 | 7 |
Shop A | 25/01/2023 | 10 |
Shop C | 30/01/2023 | 5 |
Shop A | 05/02/2023 | 3 |
So, my table , should returns the following information
Shop A | 01/01/2023 | 10 |
Shop B | 01/01/2023 | 0 |
Shop C | 01/01/2023 | 0 |
Shop A | 12/01/2023 | 10 |
Shop B | 12/01/2023 | 8 |
Shop C | 12/01/2023 | 0 |
Shop A | 15/01/2023 | 15 |
Shop B | 15/01/2023 | 8 |
Shop C | 15/01/2023 | 0 |
Shop A | 20/01/2023 | 15 |
Shop B | 20/01/2023 | 15 |
Shop C | 20/01/2023 | 0 |
Shop A | 25/01/2023 | 25 |
Shop B | 25/01/2023 | 15 |
Shop C | 25/01/2023 | 0 |
Shop A | 30/01/2023 | 25 |
Shop B | 30/01/2023 | 15 |
Shop C | 30/01/2023 | 5 |
Shop A | 05/02/2023 | 28 |
Shop B | 05/02/2023 | 15 |
Shop C | 05/02/2023 | 5 |
Any idea of how could I achieve that ?
Thank you for your help 🙂
Hi @Anonymous - First let's create a cumulative measure values as below
Cumulative Value =
CALCULATE(
SUM('Sales'[Value]),
FILTER(
ALLSELECTED('Calendar'),
'Calendar'[Date] <= MAX('Calendar'[Date])
)
)
for missing date another measure
Fill Missing Dates =
VAR SelectedShop = MAX('Sales'[Shop])
RETURN
IF(
ISBLANK([Cumulative Value]),
CALCULATE(
MAX([Cumulative Value]),
FILTER(
ALL('Calendar'),
'Calendar'[Date] <= MAX('Calendar'[Date]) &&
'Sales'[Shop] = SelectedShop
)
),
[Cumulative Value]
)
Add this measure in your visual (Table or matrix) and check
Hope it works
Proud to be a Super User! | |
Thank you for your help
I tested it with a simple dataset, but it is not working
There is no difference between the two measures
User | Count |
---|---|
78 | |
74 | |
42 | |
32 | |
28 |
User | Count |
---|---|
104 | |
93 | |
52 | |
50 | |
46 |