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
Norbertus
Helper V
Helper V

Combine Error Messages when present in 1 timebox

Hi,

 

We have data in our dataset (logfile) that are the erroritems from an object

Date TimeObjectDescriptionCount TimeHourMinute
4-10-2022 06:00AOverflow1 06:000600
4-10-2022 06:15AOverflow1 06:150615
4-10-2022 08:43AOverflow1 08:430843
4-10-2022 08:59BOut of Order1 08:590859
4-10-2022 09:15BTest1 09:150915
4-10-2022 09:23BOut of Order1 09:230923

 

We have a variable (CombineHours). In this example 1 hour

There is also a dimension table with hours & minutes

 

The result we need is dat if there are 2 error logs (from the same object and the same description) in 1 hour (variable) that has count as 1 logitem.

 

Date TimeObjectDescriptionCount
4-10-2022 06:00AOverflow1
4-10-2022 06:15AOverflow0
4-10-2022 08:43AOverflow1
4-10-2022 08:59BOut of Order1
4-10-2022 09:15BTest1
4-10-2022 09:23BOut of Order0

 

hopefully someone can help me 

1 ACCEPTED SOLUTION
Norbertus
Helper V
Helper V

Hi,

after a few hours thinking I build the next solution:

 

Measure: =
VAR offset = 0
VAR __hour =
    SELECTEDVALUE ( BundelenUren[Uren], MAX ( BundelenUren[Uren] ) )
VAR timetable =
    ADDCOLUMNS (
        GENERATESERIES ( 0 + offset, 24, __hour ),
        "start", TIME ( [Value], 0, 0 ),
        "end", TIME ( [Value] + __hour, 0, 0 )
    )
VAR result =
    SUMMARIZE (
        timetable,
        [start],
        [end],
        "aantal",
            CALCULATE (
                COUNTROWS (
                    GROUPBY (
                        'fact-abb-melding',
                        'fact-abb-melding'[Datum],
                        'fact-abb-melding'[Asset],
                        'fact-abb-melding'[Bericht]
                    )
                ),
                FILTER (
                    'fact-abb-melding',
                    TIMEVALUE ( 'fact-abb-melding'[EventDateTimeUTC] ) >= [start]
                        && TIMEVALUE ( 'fact-abb-melding'[EventDateTimeUTC] ) < [end]
                        && 'fact-abb-melding'[InOut] = "+"
                )
            )
    )
VAR timeboxaantal =
    SUMX ( result, [aantal] )
RETURN
    timeboxaantal

 

The only thing is that the measure is verry slow because i have 5 mio records

View solution in original post

2 REPLIES 2
Norbertus
Helper V
Helper V

Hi,

after a few hours thinking I build the next solution:

 

Measure: =
VAR offset = 0
VAR __hour =
    SELECTEDVALUE ( BundelenUren[Uren], MAX ( BundelenUren[Uren] ) )
VAR timetable =
    ADDCOLUMNS (
        GENERATESERIES ( 0 + offset, 24, __hour ),
        "start", TIME ( [Value], 0, 0 ),
        "end", TIME ( [Value] + __hour, 0, 0 )
    )
VAR result =
    SUMMARIZE (
        timetable,
        [start],
        [end],
        "aantal",
            CALCULATE (
                COUNTROWS (
                    GROUPBY (
                        'fact-abb-melding',
                        'fact-abb-melding'[Datum],
                        'fact-abb-melding'[Asset],
                        'fact-abb-melding'[Bericht]
                    )
                ),
                FILTER (
                    'fact-abb-melding',
                    TIMEVALUE ( 'fact-abb-melding'[EventDateTimeUTC] ) >= [start]
                        && TIMEVALUE ( 'fact-abb-melding'[EventDateTimeUTC] ) < [end]
                        && 'fact-abb-melding'[InOut] = "+"
                )
            )
    )
VAR timeboxaantal =
    SUMX ( result, [aantal] )
RETURN
    timeboxaantal

 

The only thing is that the measure is verry slow because i have 5 mio records

v-jayw-msft
Community Support
Community Support

Hi @Norbertus ,

 

Please try:

 

Column = 
var pretime = CALCULATE(MAX('Table'[Date Time]),FILTER(ALLEXCEPT('Table','Table'[Object],'Table'[Description]),'Table'[Date Time]<EARLIER('Table'[Date Time])))
var diff = DATEDIFF(pretime,'Table'[Date Time],MINUTE)
return
IF(diff=BLANK()||diff>60,1,0)

 

vjaywmsft_0-1664956700769.png

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

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.