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
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
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.