Forum Discussion
Cumulative Total
- 1 year ago
Hi Libin7963 ,
Once try this:
On Hand Cumulative Total :=
VAR CurrentDate = MAX('DimDate'[Date])
RETURN
SUMX(
FILTER(
ALL('DimDate'),
'DimDate'[Date] <= CurrentDate
),
VAR LoopDate = 'DimDate'[Date]
RETURN
CALCULATE(
COUNTROWS(
FILTER(
Table1,
Table1[ValidDate] < LoopDate &&
(
ISBLANK(Table1[DecisionDate]) ||
Table1[DecisionDate] >= LoopDate
) &&
Table1[Type] IN {
"01", "02", ..., "18"
}
)
),
CROSSFILTER('DimDate'[Date], Table1[ValidDate], None)
)
)
Replaced earlier with variable loopdate try this
On Hand Cumulative Total =
VAR CurrentDate = MAX('DimDate'[Date])
RETURN
SUMX(
FILTER(
ALL('DimDate'),
'DimDate'[Date] <= CurrentDate
),
VAR LoopDate = 'DimDate'[Date]
RETURN
CALCULATE(
COUNTROWS(
FILTER(
Table1,
Table1[ValidDate] < LoopDate &&
(
ISBLANK(Table1[DecisionDate]) ||
Table1[DecisionDate] >= LoopDate
) &&
Table1[Type] IN {
"01", "02", "03", "04", "05", "06", "07", "08", "09",
"10", "11", "12", "13", "14", "15", "16", "17", "18"
}
)
),
CROSSFILTER('DimDate'[Date], Table1[ValidDate], None)
)
)
getting this
- Amar_Kumar1 year agoSuper User
On Hand Cumulative Total =
VAR CurrentDate = MAX('DimDate'[Date])
-- Pre-filtered table
VAR FilteredBase =
FILTER(
Table1,
Table1[Type] IN {
"01", "02", "03", "04", "05", "06", "07", "08", "09",
"10", "11", "12", "13", "14", "15", "16", "17", "18"
}
)
RETURN
SUMX(
FILTER(
ALL('DimDate'),
'DimDate'[Date] <= CurrentDate
),
VAR LoopDate = 'DimDate'[Date]
RETURN
CALCULATE(
COUNTROWS(
FILTER(
FilteredBase,
FilteredBase[ValidDate] < LoopDate &&
(
ISBLANK(FilteredBase[DecisionDate]) ||
FilteredBase[DecisionDate] >= LoopDate
)
)
),
CROSSFILTER('DimDate'[Date], Table1[ValidDate], None)
)
)
- Libin79631 year agoHelper II
Below table shows the on hand non cumulative for my visual
but the cumulative visual is showing below numbers. I think it is not filtering properly
- v-menakakota1 year agoCommunity Support
Hi Libin7963 ,
Thank you for reaching out to us on the Microsoft Fabric Community Forum.
Can you try this Dax:
On Hand Cumulative Total =
CALCULATE(
CALCULATE(
sumx(
FILTER(
Table1,
Table1[ValidDate] < MIN('DimDate'[Date]) &&
(
ISBLANK(Table1[DecisionDate]) ||
Table1[DecisionDate] >= MIN('DimDate'[Date])
) &&
Table1[Type] IN {
"01", "02", "03", "04", "05", "06", "07", "08",
"09", "10", "11", "12", "13", "14", "15", "16",
"17", "18"
}
),
Table1[REFVAL]
),
CROSSFILTER('DimDate'[Date], Table1[ValidDate], None)
),
FILTER(
ALL('DimDate'),
'DimDate'[Date] <= MAX('DimDate'[Date])
)
)If this post was helpful, please give us Kudos and consider marking Accept as solution to assist other members in finding it more easily.
- v-menakakota1 year agoCommunity Support
Hi Libin7963 ,
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.
- Libin79631 year agoHelper II
Hi, sorry for late response. I got this error
- Libin79631 year agoHelper II
It is text datatype which looks like 200/255/FNC . I am trying to find the count of rows and not total
- v-menakakota1 year agoCommunity Support
Hi Libin7963 ,
Try to Replace the measure with Countx and check if it works. - Libin79631 year agoHelper II
No, that didn't work. My data is like this and it is the Case count cumulative is what I am not getting
- v-menakakota1 year agoCommunity Support
Hi Libin7963 ,
Once try this:
On Hand Cumulative Total :=
VAR CurrentDate = MAX('DimDate'[Date])
RETURN
SUMX(
FILTER(
ALL('DimDate'),
'DimDate'[Date] <= CurrentDate
),
VAR LoopDate = 'DimDate'[Date]
RETURN
CALCULATE(
COUNTROWS(
FILTER(
Table1,
Table1[ValidDate] < LoopDate &&
(
ISBLANK(Table1[DecisionDate]) ||
Table1[DecisionDate] >= LoopDate
) &&
Table1[Type] IN {
"01", "02", ..., "18"
}
)
),
CROSSFILTER('DimDate'[Date], Table1[ValidDate], None)
)
) - v-menakakota1 year agoCommunity Support
Hi Libin7963 ,
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.