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
MoOnan
Frequent Visitor

Show errors that occur only after the latest flag

Hi,

I am making a report based on a table with some files upload statistics. Sometimes the process of files upload crashes and datasets are duplicated or some data is missing. One way to track it is to check minimum and maximum id of uploaded datasets. New dataset's minimum id should always be calculated this way: 

previous max id + 1 = next minimum id

 

When there is a discrepancy we reload relevant components. But sometimes error occures again after reload.

 

What I'm trying to achieve is that when I select error on a slicer, I want it to only show the rows that have an invalid minimum ID, but only after the last reload.

 

Sample data below:

Name  Dataset  DateMin Id  Max IdStatus  ErrorsReloadFlag
AAAD1417.03.2023  131,00   140,00   Sent  
AAAD1317.03.2023133,00 140,00 Not Sent  
AAAD1216.03.2023103,00 130,00Sent Reload
AAAD712.02.2023125,00 130,00SentError 
AAAD609.02.2023103,00 120,00Sent  
BBBD1517.03.202383,00 91,00Sent  
BBBD1116.03.202375,00 82,00Sent  
BBBD912.03.202365,00 74,00SentError 
BBBD301.02.202345,00 60,00Sent Reload
BBBD231.12.202251,00 60,00SentError 
BBBD127.12.202245,00 48,00Sent  
CCCD1015.03.2023173,00 180,00SentError 
CCCD826.02.2023170,00 180,00Sent Reload
CCCD507.02.2023170,00 175,00SentError 
CCCD401.02.2023170,00 175,00Sent  

 

Datasets number: D13, D7, D2, D5 are the records, which had wrong minimum id, but where reloaded or not sent, therefore they aren't issues anymore and shouldn't appear in the result.

 

According to that, this is expected result:

NameDataset  DateMin IdMax IdErrors  Status
BBBD912.03.2023  65,00   74,00Error Sent
CCCD1015.03.2023  173,00   180,00  Error Sent

 

This is what I did so far:

 

Previous_Value = CALCULATE(
MAX('Table'[Max ID]),
FILTER('Table','Table'[Name] = EARLIER('Table'[Name]) && 'Table'[Date] < EARLIER('Table'[Date]) && EARLIER('Table'[ReloadFlag] ) <> "RELOAD" ))
 
Id_Control = IF(Table[Status] <>"Sent" || Table[ReloadFlag] = "RELOAD", 0,
(IF(Table[Min Id]= (Table[Previous_Value]+1),0, 1)))
 
However, I don't know how to arrange it so that it will show me only errors occuring after the latest reload and won't show me errors where datasets have status "Not Sent".
I will be very grateful if someone could help me, because I am really stuck on this issue..
1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @MoOnan 

 

You can try the following methods.

Column:

ReloadDate = 
CALCULATE ( MAX ( 'Table'[Date]),
    FILTER ( 'Table', 'Table'[Dataset]=EARLIER('Table'[Dataset] )
                   && EARLIER ( 'Table'[ReloadFlag] ) = "RELOAD" ) )
ReloadNextDate = 
CALCULATE ( MIN ( 'Table'[Date] ),
FILTER (ALL ( 'Table' ), 'Table'[Name] = EARLIER ( 'Table'[Name] )
            && 'Table'[Date] > CALCULATE ( MAX ( 'Table'[ReloadDate] ),
                               FILTER ( 'Table', [Name] = EARLIER ( 'Table'[Name] )))))
Result = IF([Date]=[ReloadNextDate]&&[Errors]="Error",[Dataset],BLANK())

vzhangti_0-1679465027833.png

New Table =
FILTER (
    SUMMARIZE (
        'Table',
        'Table'[Name],
        'Table'[Result],
        'Table'[Date],
        'Table'[Max Id],
        'Table'[Min Id],
        'Table'[Errors],
        'Table'[Status]
    ),
    [Result] <> BLANK ()
)

vzhangti_1-1679465340355.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

1 REPLY 1
v-zhangti
Community Support
Community Support

Hi, @MoOnan 

 

You can try the following methods.

Column:

ReloadDate = 
CALCULATE ( MAX ( 'Table'[Date]),
    FILTER ( 'Table', 'Table'[Dataset]=EARLIER('Table'[Dataset] )
                   && EARLIER ( 'Table'[ReloadFlag] ) = "RELOAD" ) )
ReloadNextDate = 
CALCULATE ( MIN ( 'Table'[Date] ),
FILTER (ALL ( 'Table' ), 'Table'[Name] = EARLIER ( 'Table'[Name] )
            && 'Table'[Date] > CALCULATE ( MAX ( 'Table'[ReloadDate] ),
                               FILTER ( 'Table', [Name] = EARLIER ( 'Table'[Name] )))))
Result = IF([Date]=[ReloadNextDate]&&[Errors]="Error",[Dataset],BLANK())

vzhangti_0-1679465027833.png

New Table =
FILTER (
    SUMMARIZE (
        'Table',
        'Table'[Name],
        'Table'[Result],
        'Table'[Date],
        'Table'[Max Id],
        'Table'[Min Id],
        'Table'[Errors],
        'Table'[Status]
    ),
    [Result] <> BLANK ()
)

vzhangti_1-1679465340355.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

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.