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

Summarize a table keeping only first occurrences in timeline

Hello,

 

I would like to show WHEN and HOW MANY equipment failures occur in timeline. Then I use the following code:

CALCULATE(

     COUNTROWS(

          GROUPBY(
               'IssueTable',
               'IssueTable'[IssueID],
               'IssueTable'[Plant],
               'IssueTable'[Equipment]
          )
     )
)

 

My IssueTable have multiple rows for every issue reported but most rows are only updates of a single one issue. When I put these data in a timeline chart (bar graph), each update counts as a NEW issue (thats the problem!).

 

IssueTable

DateIssueIDPlantEquipmentRemarks (free text)
01/jan/211AlphaTurbineInitial issue reporting
02/jan/211AlphaTurbineUpdate1
03/jan/211AlphaTurbineUpdate2
02/jan/212AlphaTurbineInitial issue reporting
03/jan/212AlphaTurbineUpdate1
04/jan/212AlphaTurbineUpdate2
07/jan/211BetaGeneratorInitial issue reporting
08/jan/211BetaGeneratorUpdate1
09/jan/211BetaGeneratorUpdate2

 

This is what I get:

 

danilopbr_0-1626474700227.png

 

What I wanted:

 

danilopbr_1-1626474849920.png

 

I appreciate any help.

1 ACCEPTED SOLUTION

Hi  @danilopbr ,

 

First go to query editor>add an index column;

 

 

Then create a measure as below:

Measure = 
var _minindex=CALCULATE(MIN('Table'[Index]),FILTER(ALL('Table'),'Table'[IssueID]=MAX('Table'[IssueID])&&'Table'[Plant]=MAX('Table'[Plant])))
Return
IF(MAX('Table'[Index])=_minindex,1,BLANK())

And you will see:

vkellymsft_0-1626760819404.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

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

View solution in original post

9 REPLIES 9
aj1973
Community Champion
Community Champion

Hi @danilopbr 
Is this good?

aj1973_1-1626701974025.png

 

 

 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Hello Amine Jerbi.

In fact this column (Remarks) is a free text one. That's why it has random content.

Do you know how to solve it?

Thank you for your collaboration.

aj1973
Community Champion
Community Champion

What is the source? Data in that column(Remarks) how is it inserted?

Basicaly you need a column where you have a standard input of the remarks, do you have one like it?

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Data in that column(Remarks) how is it inserted?

Answer: it is typed with a description of the failure in a free style. There is no standard for filling this column.

 

Basicaly you need a column where you have a standard input of the remarks, do you have one like it?
Answer: I don't. I tried in many ways to find a code that summarizes a table considering only the first record (based on date column), because [Remarks] column is a free text (no standard).

aj1973
Community Champion
Community Champion

I don't know how to help you on this other than add a column where you make it look like standard data in it according to what you see in the Column Remarks, But this won't be automatic if the user enters something different that it already exist.

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Thank you so much Amine.

Hi  @danilopbr ,

 

First go to query editor>add an index column;

 

 

Then create a measure as below:

Measure = 
var _minindex=CALCULATE(MIN('Table'[Index]),FILTER(ALL('Table'),'Table'[IssueID]=MAX('Table'[IssueID])&&'Table'[Plant]=MAX('Table'[Plant])))
Return
IF(MAX('Table'[Index])=_minindex,1,BLANK())

And you will see:

vkellymsft_0-1626760819404.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

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

Sorry for this delayed feedback.

Your suggestion was simple and brilliant.
Just a question: you used the calculate modifier below to group the table events, right? I would never have thought like this 😄

'Table'[IssueID] = MAX('Table'[IssueID]) && 'Table'[Plant] = MAX('Table'[Plant])
aj1973
Community Champion
Community Champion

Welcome 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

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.