Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Daniela_Romasko
Frequent Visitor

Otimização DAX para cálculo acumulado

Olá pessoal, 

 

Preciso melhorar o código do cálculo faturamento acumulado por cliente e % acumulado do faturamento por clinete, pois o que fiz está com a performance ruim, está demorando muito para mostrar o resultado e quando realizo a publicação do Dashboard ele excede o limite de processamento.

fat acum.PNG

 

Faturamento acumulado cliente =
VAR vFatContexto = [Total vendas]
VAR vFatTotal = CALCULATE([Total vendas],ALLSELECTED(TB_CLIENTES[CODIGO CLIENTE]))
VAR VfatAcum = CALCULATE(
    [Total vendas],
    FILTER(
        ALLSELECTED(TB_CLIENTES[CODIGO CLIENTE]),
        [Total vendas] >= vFatContexto
    )
)
RETURN
VfatAcum
 
perc fat acum.PNG

 

% Acum Fat Cliente =
VAR vFatTotal = CALCULATE([Total vendas], ALLSELECTED(TB_CLIENTES[CODIGO CLIENTE]))

RETURN
DIVIDE([Faturamento acumulado cliente],vFatTotal)



Alguém poderia me ajudar a melhorar? 

1 ACCEPTED SOLUTION
ppm1
Solution Sage
Solution Sage

Please try this measure expression instead.

Customer accrued billing =
VAR vFatContext = [Total sales]
VAR vSummary =
    ADDCOLUMNS (
        ALLSELECTED ( TB_CLIENTES[CUSTOMER CODE] ),
        "cSales", [Total sales]
    )
VAR vResult =
    SUMX ( FILTER ( vSummary, [cSales] >= vFatContext ), [cSales] )
RETURN
    vResult

Pat

Microsoft Employee

View solution in original post

3 REPLIES 3
ppm1
Solution Sage
Solution Sage

Please try this measure expression instead.

Customer accrued billing =
VAR vFatContext = [Total sales]
VAR vSummary =
    ADDCOLUMNS (
        ALLSELECTED ( TB_CLIENTES[CUSTOMER CODE] ),
        "cSales", [Total sales]
    )
VAR vResult =
    SUMX ( FILTER ( vSummary, [cSales] >= vFatContext ), [cSales] )
RETURN
    vResult

Pat

Microsoft Employee

Boa tarde, estou com o mesmo problema, e mesmo fazendo essa tabela virtual o processamento não é suportado. Minhas base é com 10 mil clientes... teria outra sugestão?

v-zhangti
Community Support
Community Support

Hi, @Daniela_Romasko 

 

Can you provide sample data for testing? Sensitive information can be removed in advance. What kind of expected results do you expect? You can also show it with pictures. I look forward to your response.

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

July Newsletter

Fabric Community Update - July 2024

Find out what's new and trending in the Fabric Community.