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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register 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
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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

Top Solution Authors