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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
JandeMul
New Member

Counting log messages

I've got a table that consists of three columns; an ID, a DateTime and a LogMessage. There are +/- 20k rows in the table. The log message are less than a dozen different types several kinds of error messages, some operations messages and some warnings. All messages are unique as they ususally have a username in the message but each type has a set format. A few examples below:

 

"Error, User 123456JohnSnow wasn't able to synch"

"User 123456SansaStark was not found in the AD synch from application"

"User 123456BobbyB is inactive according to table, remove from AD"

 

I need to count the total amount of messages of a certain type over a period of time. For example: The "User not found in AD sync from application" was found 330 times past month Or "Error, User wasn't able to sync" was found 3 times past year.

 

I'm new to PowerBI and would love for somebody to point me in the right direction.

 

Thanks in advance.

1 ACCEPTED SOLUTION
barritown
Super User
Super User

Hi @JandeMul,

For example, using the DAX functions SWITCH and CONTAINSSTRING and the wildcard character *, you can assign types to errors and then count them.

barritown_0-1705418939097.png

DAX calculated column in plain text:

Column = 
SWITCH ( TRUE(),
CONTAINSSTRING ( [Message], "Error, User * wasn't able to synch" ), "Type1",
CONTAINSSTRING ( [Message], "User * was not found in the AD synch from application" ), "Type2",
CONTAINSSTRING ( [Message], "User * is inactive according to table, remove from AD" ), "Type3",
"Other" )

Best Regards,

Alexander

My YouTube vlog in English

My YouTube vlog in Russian

View solution in original post

1 REPLY 1
barritown
Super User
Super User

Hi @JandeMul,

For example, using the DAX functions SWITCH and CONTAINSSTRING and the wildcard character *, you can assign types to errors and then count them.

barritown_0-1705418939097.png

DAX calculated column in plain text:

Column = 
SWITCH ( TRUE(),
CONTAINSSTRING ( [Message], "Error, User * wasn't able to synch" ), "Type1",
CONTAINSSTRING ( [Message], "User * was not found in the AD synch from application" ), "Type2",
CONTAINSSTRING ( [Message], "User * is inactive according to table, remove from AD" ), "Type3",
"Other" )

Best Regards,

Alexander

My YouTube vlog in English

My YouTube vlog in Russian

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.