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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.