Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I have a measure below working that calculates the cumulative with some filter conditions. This measure works correctly for up to 10 thousand records and after that it gets very slow, showing a lack of memory in the power bi.
I would like to optimize this measure so that it works for larger amounts of data.
I thank the help of all you.
------------------------------------------------------------
Solved! Go to Solution.
Please try this measure instead. It runs much faster and seems to return the same results.
Acumulado sla New =
VAR thisindex =
MAX( 'Relatório de Histórico de Casos'[INDEX] )
VAR indices =
CALCULATETABLE(
SUMMARIZE(
'Relatório de Histórico de Casos',
'Relatório de Histórico de Casos'[INDEX],
'Relatório de Histórico de Casos'[TOTAL MIN SLA]
),
ALL( 'Relatório de Histórico de Casos' ),
VALUES( 'Relatório de Histórico de Casos'[Número do caso] ),
'Relatório de Histórico de Casos'[Have SLA?] = "Y"
)
RETURN
SUMX(
FILTER( indices, 'Relatório de Histórico de Casos'[INDEX] <= thisindex ),
'Relatório de Histórico de Casos'[TOTAL MIN SLA]
)
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Please try this measure instead. It runs much faster and seems to return the same results.
Acumulado sla New =
VAR thisindex =
MAX( 'Relatório de Histórico de Casos'[INDEX] )
VAR indices =
CALCULATETABLE(
SUMMARIZE(
'Relatório de Histórico de Casos',
'Relatório de Histórico de Casos'[INDEX],
'Relatório de Histórico de Casos'[TOTAL MIN SLA]
),
ALL( 'Relatório de Histórico de Casos' ),
VALUES( 'Relatório de Histórico de Casos'[Número do caso] ),
'Relatório de Histórico de Casos'[Have SLA?] = "Y"
)
RETURN
SUMX(
FILTER( indices, 'Relatório de Histórico de Casos'[INDEX] <= thisindex ),
'Relatório de Histórico de Casos'[TOTAL MIN SLA]
)
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
@Spotto Did this measure improve things for you?
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Generally, you want to avoid filtering on entire tables and, instead, filter only on individual columns.
See if one of these alternatives works for you:
Acumulado sla =
VAR nrcaso = MAX ( 'Relatório de Histórico de Casos'[Número do caso] )
VAR indice = MAX ( 'Relatório de Histórico de Casos'[INDEX] )
VAR sla = "Y"
VAR solucao =
CALCULATE (
SUM ( 'Relatório de Histórico de Casos'[TOTAL MIN SLA] ),
'Relatório de Histórico de Casos'[INDEX] <= indice,
'Relatório de Histórico de Casos'[Número do caso] = nrcaso,
'Relatório de Histórico de Casos'[Have SLA?] = sla
)
RETURN
solucao
or
Acumulado sla =
VAR nrcaso = MAX ( 'Relatório de Histórico de Casos'[Número do caso] )
VAR indice = MAX ( 'Relatório de Histórico de Casos'[INDEX] )
VAR sla = "Y"
VAR solucao =
CALCULATE (
SUM ( 'Relatório de Histórico de Casos'[TOTAL MIN SLA] ),
REMOVEFILTERS ( 'Relatório de Histórico de Casos' ),
'Relatório de Histórico de Casos'[INDEX] <= indice,
'Relatório de Histórico de Casos'[Número do caso] = nrcaso,
'Relatório de Histórico de Casos'[Have SLA?] = sla
)
RETURN
solucao
unfortunately it didn't work, I put the file below for download, if you can take a look I would appreciate it very much.
Hmm. Unfortunately, this DAX method of computing cumulative sums is O(n^2) and I don't know that you can improve it much.
You might try computing it in the query editor using a function like List.Accumulate to avoid quadratic complexity. See here for an example:
https://community.powerbi.com/t5/Desktop/How-to-do-a-running-Sum-by-group-in-Power-Query/m-p/290123
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
97 | |
95 | |
80 | |
77 | |
66 |
User | Count |
---|---|
130 | |
106 | |
105 | |
86 | |
72 |