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
adeeln
Post Patron
Post Patron

Necesita ayuda para escribir DAX.

I want to show "New Active Customers" according to the following screenshot.

Need help with writing measures for two visual objects.

First. In which "New Active Customers" shows from the Minimum MonthYear(In date table) to the Selected MonthYear from Slicer .
Second. And in the second Visual it shows the "New Active Clients" of the last 24 months.


Here is the link for the live dashboard according to which I want to show.
https://public.tableau.com/profile/lintao#!/vizhome/DigitalStrategyDashboard/ClientInsight
I have used the following measures.


For new active customers #
New active clients? 
var minSelectedDate to minx (ALLSELECTED (DimDate), DimDate [Date])
return
CALCULATE (
DISTINCTCOUNT (FactDigitalStrategy [ClientKey]),
FILTER (DimDate,
DimDate [Date]>? minSelectedDate
), USERELATIONSHIP (FactDigitalclientStrategy [new Date], Dim Date [DimDigitalStrategy] ))
For "The last 24 months new active customers"
New Active Customers (last 24 months) 
VAR MaxFactDate?
CALCULATE (MAX (FactDigitalStrategy [Date]), ALL ('DimDate'))
VAR FDate (VAR FDate)
ENDOFMONTH ('DimDate' [Date])
VA Edate (VAR Edate)
EDATE (FDate, -24)
return
IF (
MaxFactDate < - MAX ('DimDate' [Date])
&& MaxFactDate> - Edate,
CALCULATE ([New active clients], ALL ('DimDate')) + 0
)
For Visual in which "New active customers" shows from the year of the minimum month to the year of the selected month.
Active Customers (last n months) below the next part of the page of the next part of the 
VAR page MaxFactDate?
CALCULATE (MAX (FactDigitalStrategy [Date]), ALL ('DimDate'))
VAR FDate (VAR FDate)
ENDOFMONTH ('DimDate' [Date])
VA Edate (VAR Edate)
CALCULATE (MIN (DimDate [Date]), ALL ( 'DimDate'))
return
IF (
MaxFactDate <- MAX ('DimDate' [Date])
&& MaxFactDate> - Edate,
CALCULATE ([Active Clients], ALL ('DimDate'))
) + 0
Here is my Pbix file link.
https://www.dropbox.com/s/yapdk88x7duhuqa/Digital%20Strategy%20-%20Client%20Insight%20test.pbix?dl=0
1 ACCEPTED SOLUTION
PaulDBrown
Community Champion
Community Champion

@adeeln

Vea si esto funciona para usted (disculpas ya que no aplico la codificación de color que tiene en su original):

Result.JPG

1) Para calcular los nuevos clientes por mes:

New clients in month =
VAR PrevYM =
     ( MAX ( FactDigitalStrategy[Year] ) - 1 ) * 100
        + RIGHT ( SELECTEDVALUE ( FactDigitalStrategy[MonthYearNo] ), 2 )
VAR ActualClients =
    VALUES ( FactDigitalStrategy[ClientKey] )
VAR PrevYearMonthClients =
    CALCULATETABLE (
        VALUES ( FactDigitalStrategy[ClientKey] ),
        FILTER (
            ALL ( FactDigitalStrategy ),
            FactDigitalStrategy[MonthYearNo] = PrevYM
        )
    )
RETURN
    COUNTROWS ( EXCEPT ( ActualClients, PrevYearMonthClients ) )

2) Para filtrar los objetos visuales en función de la selección en las segmentaciones de datos, creé una nueva tabla desconectada para los clientes nuevos y activos (y usé esta tabla para los objetos visuales)

3) Para filtrar los objetos visuales, creé una medida para usar en los filtros para los objetos visuales en el panel de filtro:

New client table (Filtered) =
IF (
    SELECTEDVALUE ( '1 New client table'[MonthYearNbr] )
        <= SELECTEDVALUE ( DimDate[MonthYearNbr] ),
    1
)

Háganos saber si necesita más ayuda

Estoy adjuntando el archivo PBIX de muestra





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

6 REPLIES 6
PaulDBrown
Community Champion
Community Champion

@adeeln

Vea si esto funciona para usted (disculpas ya que no aplico la codificación de color que tiene en su original):

Result.JPG

1) Para calcular los nuevos clientes por mes:

New clients in month =
VAR PrevYM =
     ( MAX ( FactDigitalStrategy[Year] ) - 1 ) * 100
        + RIGHT ( SELECTEDVALUE ( FactDigitalStrategy[MonthYearNo] ), 2 )
VAR ActualClients =
    VALUES ( FactDigitalStrategy[ClientKey] )
VAR PrevYearMonthClients =
    CALCULATETABLE (
        VALUES ( FactDigitalStrategy[ClientKey] ),
        FILTER (
            ALL ( FactDigitalStrategy ),
            FactDigitalStrategy[MonthYearNo] = PrevYM
        )
    )
RETURN
    COUNTROWS ( EXCEPT ( ActualClients, PrevYearMonthClients ) )

2) Para filtrar los objetos visuales en función de la selección en las segmentaciones de datos, creé una nueva tabla desconectada para los clientes nuevos y activos (y usé esta tabla para los objetos visuales)

3) Para filtrar los objetos visuales, creé una medida para usar en los filtros para los objetos visuales en el panel de filtro:

New client table (Filtered) =
IF (
    SELECTEDVALUE ( '1 New client table'[MonthYearNbr] )
        <= SELECTEDVALUE ( DimDate[MonthYearNbr] ),
    1
)

Háganos saber si necesita más ayuda

Estoy adjuntando el archivo PBIX de muestra





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






adeeln
Post Patron
Post Patron

Please help to write a DAX.

PaulDBrown
Community Champion
Community Champion

@adeeln

Lo siento, no estoy entendiendo lo que está tratando de lograr con"Nuevos clientes activos". ¿Nuevo en comparación con cuándo?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






@PaulDBrown necesito mostrar los "Nuevos clientes activos" desde la fecha mínima (que presentan de hecho o tabla de fechas) a la fecha máxima seleccionada desde Mes o año Slicer.

Para una mejor comprensión, este es el enlace para el panel en vivo según el cual quiero mostrar.
https://public.tableau.com/profile/lintao#!/vizhome/DigitalStrategyDashboard/ClientInsight

@adeeln

Lo sentimos si estoy siendo denso, pero normalmente whaen uno dice "Nuevos clientes activos", la idea es que estos son clientes que están activos (en el período) pero no estaban activos en otro período. Por ejemplo, nuevos clientes activos este año frente al año pasado (que serían clientes que no estuvieron activos el año pasado).

Mencionas un período, pero no cuando consideras que un cliente es "Nuevo" (en comparación con el mes anterior?

Sin embargo, si está buscando clientes que estén activos, puede utilizar DISTINCTCOUNT





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






@PaulDBrown  In my report, I have 2 types of KPI according to Client . one is "Active Clients #" and this is the distinctcount of ClientKey.
And second is "New Active Clients #" and this is New Clients.
Need to help me to calculate the "New Active Clients #" measure.
And show this "New Active Clients #" according to the live dashboard. The live dashboard link is here

 https://public.tableau.com/profile/lintao#!/vizhome/DigitalStrategyDashboard/ClientInsight.

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.