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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
av9
Helper III
Helper III

Sume los valores por categoría cuando esté disponible en el conjunto de datos con diferentes meses

Hola, tengo un escenario en el que estoy tratando de calcular el importe total por cliente. Mis datos se reciben en el siguiente formato. Cada mes obtengo un Importe Total por categoría por cliente, y el Total es estático, es decir, no necesito tener un total en ejecución, simplemente tomo el valor de cada mes.

FechaClienteCategoríaImporte total
30/08/2020AWeb$100
30/08/2020AMóvil$0
30/08/2020BWeb$100
30/08/2020BMóvil$100
30/09/2020AWeb$500
30/09/2020AMóvil$500

Así que cuando miro los datos de hoy quiero que los totales de cada cliente sean:

Total Combinado Hoy
Cliente A$1000
Cliente B$200Como no tengo los datos de Sep 2020 para el cliente B, el total se queda según el ago de 2020.

Al día siguiente: actualo los datos y se ve así:

FechaClienteCategoríaImporte total
30/08/2020AWeb$100
30/08/2020AMóvil$0
30/08/2020BWeb$100
30/08/2020BMóvil$100
30/09/2020AWeb$500
30/09/2020AMóvil$500
30/09/2020BWeb$200

Así que Total por Cliente será:

Total Combinado Hoy
A$1,000
B$300esto se compone de $200(Web-Sep2020) + $100(Mobile-Aug2020)

Y así va. una vez que los datos móviles para septiembre viene a través de entonces reemplazar los datos móviles de agosto

1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@av9,

Pruebe esta medida:

Amount = 
VAR vMobileRows =
    FILTER ( Test1, Test1[Category] = "Mobile" )
VAR vMobileMaxDate =
    MAXX ( vMobileRows, Test1[Date] )
VAR vMobileLatestRow =
    FILTER ( vMobileRows, Test1[Date] = vMobileMaxDate )
VAR vMobileAmount =
    SUMX ( vMobileLatestRow, Test1[Total Amount] )
VAR vWebRows =
    FILTER ( Test1, Test1[Category] = "Web" )
VAR vWebMaxDate =
    MAXX ( vWebRows, Test1[Date] )
VAR vWebLatestRow =
    FILTER ( vWebRows, Test1[Date] = vWebMaxDate )
VAR vWebAmount =
    SUMX ( vWebLatestRow, Test1[Total Amount] )
VAR vResult = vMobileAmount + vWebAmount
RETURN
    vResult

Hoy:

DataInsights_0-1602793726964.png

Al día siguiente:

DataInsights_1-1602793741531.png





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

1 REPLY 1
DataInsights
Super User
Super User

@av9,

Pruebe esta medida:

Amount = 
VAR vMobileRows =
    FILTER ( Test1, Test1[Category] = "Mobile" )
VAR vMobileMaxDate =
    MAXX ( vMobileRows, Test1[Date] )
VAR vMobileLatestRow =
    FILTER ( vMobileRows, Test1[Date] = vMobileMaxDate )
VAR vMobileAmount =
    SUMX ( vMobileLatestRow, Test1[Total Amount] )
VAR vWebRows =
    FILTER ( Test1, Test1[Category] = "Web" )
VAR vWebMaxDate =
    MAXX ( vWebRows, Test1[Date] )
VAR vWebLatestRow =
    FILTER ( vWebRows, Test1[Date] = vWebMaxDate )
VAR vWebAmount =
    SUMX ( vWebLatestRow, Test1[Total Amount] )
VAR vResult = vMobileAmount + vWebAmount
RETURN
    vResult

Hoy:

DataInsights_0-1602793726964.png

Al día siguiente:

DataInsights_1-1602793741531.png





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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