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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Danielecc
Helper II
Helper II

How to count changes of values in a column by group and order by date

Hi community, 

 

I need to know (using DAX creating a calculated column) how to count changes of value in a column by group and order by date.

 

Danielecc_0-1664544025932.png

In this Image (is not sorted), if you sort by "Usuario" and "Fecha" the "Usuario" ALAN only change of value 2 times, and the "usuario" DANIEL change 7 times, then the RESULT EXPECTED is create the "Calculated Column" with this data.

 

Add in text mode the data, but the real file have more columns...

 

FechaUsuarioEquipoCalculated Column
25-05-2022ALANATARGARONA2
25-05-2022ALANATARGARONA2
10-05-2022ALANATARGARONA2
10-05-2022ALANATARGARONA2
10-05-2022ALANATARGARONA2
25-05-2022ALANATARGARONA2
25-05-2022ALANATARGARONA2
10-05-2022ALANATARGARONA2
10-05-2022ALANATARGARONA2
30-03-2022ALANATARGARONA2
30-03-2022ALANATARGARONA2
30-03-2022ALANATARGARONA2
03-02-2021ALANATARGARONANB2
03-02-2021ALANATARGARONANB2
03-02-2021ALANATARGARONANB2
03-02-2021ALANATARGARONANB2
03-02-2021ALANATARGARONANB2
12-01-2022ALANATARGARONA2
12-01-2022ALANATARGARONA2
31-01-2022ALANATARGARONA2
31-01-2022ALANATARGARONA2
06-01-2021ALANATARGARONANB2
06-01-2021ALANATARGARONANB2
06-01-2021ALANATARGARONANB2
06-01-2021ALANATARGARONANB2
06-01-2021ALANATARGARONANB2
06-01-2021DANIELDANIEL-NB7
06-01-2021DANIELDANIEL-NB7
06-01-2021DANIELDANIEL-NB7
06-01-2021DANIELMARTIN-PC7
06-01-2021DANIELMARTIN-PC7
03-02-2021DANIELDANIEL-NB7
03-02-2021DANIELDANIEL-NB7
03-02-2021DANIELDANIEL-NB7
03-02-2021DANIELDANIEL-NB7
03-02-2021DANIELDANIEL-NB7
12-01-2022DANIELMARTIN-PC7
12-01-2022DANIELMARTIN-PC7
31-01-2022DANIELDANIEL-NB7
31-01-2022DANIELDANIEL-NB7
30-03-2022DANIELDANIEL-NB7
30-03-2022DANIELJUAN-NB7
30-03-2022DANIELJUAN-NB7
30-03-2022DANIELJUAN-NB7
10-05-2022DANIELDANIEL-NB7
10-05-2022DANIELDANIEL-NB7
10-05-2022DANIELDANIEL-NB7
25-05-2022DANIELDANIEL-NB7
25-05-2022DANIELDANIEL-NB7

 

Thanks for your help, best regards...

3 REPLIES 3
v-henryk-mstf
Community Support
Community Support

Hi @Danielecc ,

 

Try to use ALLEXCEPT instead of ALL function for group sorting.

Check out the following formula:

Calculated1 = CALCULATE(COUNTROWS(T),ALLEXCEPT(T,T[Usuario],T[Fecha]))
Calculated2 =
CALCULATE (
    COUNTROWS ( T ),
    FILTER (
        ALL ( T ),
        T[Usuario] = MAX ( T[Usuario] )
            && T[Fecha] = MAX ( T[Fecha] )
    )
)

 

vhenrykmstf_0-1664776161165.png

vhenrykmstf_1-1664776218687.png


If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Henrry, First of all, thanks for your answer. 

I still have the problem, but I dont have an error, the "calculated 1" give me values and "calculated 2" only give me "blank" in all the rows of that column.

I was trying something like a RANK using "Fecha" to order by date or something similar.

 

lbendlin
Super User
Super User

Your date column is not granular enough for reliable sorting. Please resubmit either with an index column or better granularity (including time, for example)

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors