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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Waraldir
New Member

Count Unique Contact Numbers with the latest Change Date!

Good morning comunity, 

i am still relatively new to DAX and need some support, with a task given to me. 

 

I have a Table.

 

(Contact No_, mail, messanger, phone, mobil, change date, change clock time). 

 

Background is, that user can give the permissions that we can reach them via the given option (mail, mobil, etc.) for advertising. 

The Problem is, that for every permission change, a new line is created. 

 

For example:

 

Contact No_ | mail | messanger | phone | mobil | change date | change clock time

000001         | 0      | 0                | 1          |      0   |  10.10.2022  | 12:05 AM

000001         | 1      | 0                | 0          |      0   |  11.10.2022  | 12:07 AM

 

My Problem is, i need to count every option with the newst date and for every single Contact No_ .

What could be a good Workarround for that problem? If you need more Information please ask me :). 

 

Cheers!

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

You could create a calculated table like

Latest data =
GENERATE (
    DISTINCT ( 'Table'[Contact no] ),
    SELECTCOLUMNS (
        CALCULATETABLE (
            TOPN ( 1, 'Table', 'Table'[change date], DESC, 'Table'[change time], DESC )
        ),
        "mail", 'Table'[mail],
        "messenger", 'Table'[messenger],
        "phone", 'Table'[phone],
        "mobile", 'Table'[mobile]
    )
)

that would have the latest values for all customers.

View solution in original post

2 REPLIES 2
Waraldir
New Member

Thank you, it worked well 🙂

 

johnt75
Super User
Super User

You could create a calculated table like

Latest data =
GENERATE (
    DISTINCT ( 'Table'[Contact no] ),
    SELECTCOLUMNS (
        CALCULATETABLE (
            TOPN ( 1, 'Table', 'Table'[change date], DESC, 'Table'[change time], DESC )
        ),
        "mail", 'Table'[mail],
        "messenger", 'Table'[messenger],
        "phone", 'Table'[phone],
        "mobile", 'Table'[mobile]
    )
)

that would have the latest values for all customers.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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