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