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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.