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
Anonymous
Not applicable

average of distinct count (promedio de la suma de un distinct count)

tengo esta tabla que muestra un distinct count de un campo con formato texto (string) de los últimos 7 días

Recuento distintivo de sthfecha
49601/07/2022 00:00
42902/07/2022 00:00
103/07/2022 00:00
104/07/2022 00:00
42805/07/2022 00:00
42006/07/2022 00:00
107/07/2022 00:00

 

Quisera obtener una medida donde resulte el promedio de los dístinct count por día y este cambie de acuerdo a los útlimos 7 días. 

 

el resultado a obtener es el siguiente: 

dax_coder_0-1657305093633.png

 

Gracias por sus comentarios

 

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

The text format of numbers can be directly converted to integer format.

vzhangti_0-1657504382758.png

Measure:

Last 7-day average =
VAR N1 =
    SUMMARIZE (
        FILTER ( ALL ( 'Table' ), [fecha] <= MAX ( 'Table'[fecha] ) ),
        [fecha],
        "Sum", SUM ( 'Table'[Recuento distintivo de sth] )
    )
VAR N2 =
    TOPN ( 7, N1, [fecha], DESC )
RETURN
    SUMX ( N2, [Sum] / 7 )

Always calculate the average of the latest 7 days.

vzhangti_1-1657504992511.png

Is this the result you expect?

 

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.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

@v-zhangti 

 

One question, how do I incorporate the distinct count rule into the measure?. I do not have the added field of the count distinction, I have the field that is in text format like this:

dax_coder_0-1657571707907.png

 

 

by the way, the table is in direct query

Hi, @Anonymous 

 

Are you trying to get a result like this?

Measure = DISTINCTCOUNT('Table'[Text])

vzhangti_0-1657797487375.png

 

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.

 

Anonymous
Not applicable

I do not have the summarized table like this:

 

dax_coder_0-1658861750013.png

 

I have the table like this: 

 

dax_coder_1-1658861786864.png

 

So, how do I incorporate the distinct count rule into the measure?

DISTINCTCOUNT('Table'[Text])

in the dax measure

 

Last 7-day average =
VAR N1 =
    SUMMARIZE (
        FILTER ( ALL ( 'Table' ), [fecha] <= MAX ( 'Table'[fecha] ) ),
        [fecha],
        "Sum", SUM ( 'Table'[Recuento distintivo de sth] )
    )
VAR N2 =
    TOPN ( 7, N1, [fecha], DESC )
RETURN
    SUMX ( N2, [Sum] / 7 )

 

 

Thanks

v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

The text format of numbers can be directly converted to integer format.

vzhangti_0-1657504382758.png

Measure:

Last 7-day average =
VAR N1 =
    SUMMARIZE (
        FILTER ( ALL ( 'Table' ), [fecha] <= MAX ( 'Table'[fecha] ) ),
        [fecha],
        "Sum", SUM ( 'Table'[Recuento distintivo de sth] )
    )
VAR N2 =
    TOPN ( 7, N1, [fecha], DESC )
RETURN
    SUMX ( N2, [Sum] / 7 )

Always calculate the average of the latest 7 days.

vzhangti_1-1657504992511.png

Is this the result you expect?

 

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
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.

Top Solution Authors