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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
ashamsuzzoha
Advocate II
Advocate II

Counting an event occurring on concurrent days once

I need some help writing a measure to calculate the number of events by day and plotting it by date. This is a sample of my table:

date

unique_id

event 

6/24/2022

1005022_1191625136_119162520_18934250

6/26/2022

1005022_1191625136_119162520_18934250

6/27/2022

1005022_1191625136_119162520_18934250

7/9/2022

1005022_1191625136_119162520_18934250

7/10/2022

1005022_1191625136_119162520_18934250

7/11/2022

1005022_1191625136_119162520_18934250

4

7/12/2022

1005022_1191625136_119162520_18934250

7/13/2022

1005022_1191625136_119162520_18934250

7/14/2022

1005022_1191625136_119162520_18934250

 

The measure I've written is:

 

 

Total L2 Charging Events Detected (2) = 
COUNTROWS(
    DISTINCT(
        SELECTCOLUMNS(
            SUMMARIZE(
                FILTER(l2_ami,l2_ami[event] <> 0),
                l2_ami[unique_id],
                l2_ami[event],
                l2_ami[date],
                "id_event_ky", CONCATENATE(CONCATENATE(l2_ami[unique_id], "_"), l2_ami[event])
            ),
            "_ky", [id_event_ky]
        )
    )
)

 

 

 
The measure works in total, but when I try in plot it against date, i'm running into the problem that some events span two days. We only want to count the event on the first day. So in June, there should be two events, one on 6/24 and 6/26. But when I plot against Date, it has events on 6/24, 6/26, and 6/27.

ashamsuzzoha_0-1702617070202.png

Any help would be appreciated.



1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@ashamsuzzoha 

maybe you can try to create a new column and put that column in the visual

11.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
ryan_mayu
Super User
Super User

@ashamsuzzoha 

maybe you can try to create a new column and put that column in the visual

11.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thanks.  Yes, this does work provided I change the connection to my date table from [date] to [date2].

you are welcome





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.