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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors