Grouping in Reports

@Suvrutt_Gurjar

I am working on generating quotation for customer for multiple equipment.
I have a parent table ‘Customer Details’ and child table ‘Quotation Details’.A customer can have multiple quotation details. Each row in Quotation details has columns such as [Part Code],[Equipment_Name],[List Price],[Qty] etc.

I am trying to generate a report for a customer with items from child table grouped by [Equipment_Name]. Something like this:

Expected Report Format

I read your post on Group By Reports and tried the same on my tables with changes. Your sample app works with one table and slice. Here, I am trying to generate report from parent table (Customer Details) and want to group the records by [Equipment_Name] from child table (Quotation Details). As suggested I have added the following VC to child table and slice:
VC [_RefEquipmentName]
INDEX((SELECT(Quotation Details[Row ID], [Equipment_Name]=[_THISROW].[Equipment_Name])),1)

VC[Related Equipment]
REF_ROWS(“Quotation Details”, “_RefEquipmentName”)

[SliceByEquipmentName]
IN([Row ID], SELECT(Quotation Details[Row ID], COUNT([Related Equipment])>0))

When I use the slice for outer loop, my entire table is repeated for as many times I have unique equipment name. Below is the image:

Report generated

Report Template

Could you help me out?

Thank you

Solved Solved
0 35 2,929
1 ACCEPTED SOLUTION

This may help.

View solution in original post

35 REPLIES 35

@Nirmal_Giri,

Could you please update what is the key column in Quotation Details Table?

The key column for Quotation Details is [Row ID].

Could you elaborate the below please? Is it repeating for all customers?

Steve
Platinum 4
Platinum 4

Replace your first <<Start>> tag with:

<<Start: FILTER("Quotation Details", ([_ROWNUMBER] = MIN(SELECT(Quotation Details[_ROWNMUMBER], ([_THISROW-1].[Equipment_Name] = [Equipment_Name])))))>>

And your second <<Start>> tag with:

<<Start: FILTER("Quotation Details", ([_THISROW-1].[Equipment_Name] = [Equipment_Name]))>>

Could you please clarify what does the [_THISROW-1] refer to?

@Steve Thank you for replying.

The parent table does not have [Equipment_Name] column. Hence, the first Start expression will throw an error.

It doesn’t refer to the parent table, it refers to the outer FILTER() expression.

3X_9_9_993f3f5ae46b2d405d62c9835303e6de019e4d10.png

Thank you for the clarification. I had read the article and completely misunderstood it.
I will attempt the Start expression again.

@Steve I am getting this error:

Failed: Action not performed because 2 errors are present. Error: Workflow rule ‘Create draft quotation (pdf)’ action ‘Action 1’ Attachment template. Expression ‘FILTER(“Quotation Details”, ([_RowNumber] = MIN(SELECT(Quotation Details[_RowNumber],([_THISROW].[Equipment_Name] = [Equipment_Name])))))’ is invalid due to: Error in expression ‘[Row ID].[Equipment_Name]’ : Unable to find column ‘Equipment_Name’. Error: Workflow rule ‘Create draft quotation (pdf)’ action ‘Action 1’ Attachment template. Start expression ‘FILTER(“Quotation Details”, ([_RowNumber] = MIN(SELECT(Quotation Details[_RowNumber],([_THISROW].[Equipment_Name] = [Equipment_Name])))))’ should generate a List of Ref values. Please verify that it generates a List and that the contents of the List are Ref values. Ref values should come from the ‘Key’ column of the referenced table…

Whoops! There should be a -1 in there, too:

<<Start: FILTER("Quotation Details", ([_ROWNUMBER] = MIN(SELECT(Quotation Details[_ROWNMUMBER], ([_THISROW-1].[Equipment_Name] = [Equipment_Name])))))>>

I’ve also updated the snippet in my original suggestion, too.

Got another error

Failed: Action not performed because 2 errors are present. Error: Workflow rule ‘Create draft quotation (pdf)’ action ‘Action 1’ Attachment template. Expression ‘End’ is invalid due to: Expression refers to undefined field. Error: Workflow rule ‘Create draft quotation (pdf)’ action ‘Action 1’ Attachment template. Expression ‘Start: FILTER(“Quotation Details”, ([_THISROW-1].[Equipment_Name] = [_THISROW].[Equipment_Name]))’ is invalid due to: Error in expression ‘[Row ID].[Equipment_Name]’ : Unable to find column ‘Equipment_Name’…

Where do I place the End expression for Outer loop. This is current template:

Actually I think the first <<Start>> tag goes inside the Part Code cell.

I am getting error messages stating that - cannot find column Equipment_Name.
When I run the same expression of the test editor, i get results but the workflow throws error.

Failed: Action not performed because 3 errors are present. Error: Workflow rule ‘Create draft quotation (pdf)’ action ‘Action 1’ Attachment template. Expression ‘[Equipment_Name]’ is invalid due to: Unable to find column ‘Equipment_Name’. Error: Workflow rule ‘Create draft quotation (pdf)’ action ‘Action 1’ Attachment template. Expression ‘FILTER(“Quotation Details”, ([_THISROW-1].[Equipment_Name] = [Equipment_Name]))’ is invalid due to: Error in expression ‘[Row ID].[Equipment_Name]’ : Unable to find column ‘Equipment_Name’. Error: Workflow rule ‘Create draft quotation (pdf)’ action ‘Action 1’ Attachment template. Start expression ‘FILTER(“Quotation Details”, ([_THISROW-1].[Equipment_Name] = [Equipment_Name]))’ should generate a List of Ref values. Please verify that it generates a List and that the contents of the List are Ref values. Ref values should come from the ‘Key’ column of the referenced table…

Lets try to narrow down which FILTER() expression is the problem. For testing, please replace the second <<Start>> tag with:

<<Start: FILTER("Quotation Details", TRUE)>>

I replaced the second <> expression and got the following error message:

Failed: Action not performed because 1 errors are present. Error: Workflow rule ‘Create draft quotation (pdf)’ action ‘Action 1’ Attachment template. Expression ‘[Equipment_Name]’ is invalid due to: Unable to find column ‘Equipment_Name’…

For the below, did you refer to Part Code header cell or Part Code value cell?

Please provide a screenshot of the entire column list of the Quotation Details table.

Column list:

Quotation Details table

[Row ID] is the key column. [Qtn_No] references Customer Details table.

Customer Details Table

This may help.

A nice, compact solution @Marc_Dillon.

@Nirmal_Giri: I believe @Marc_Dillon’s solution is much easier to implement. You may wish to explore that instead of the approach mentioned in my sample app.

I got the report working.
Thank you for help. @Suvrutt_Gurjar @Steve

Hi @Nirmal_Giri,

Thanks for the update. Great to know that you got it working with @Steve’s guidance. Frankly I did not add any contribution in your query in this entire post thread.

I may however request you to share your final working template if possible so that anyone having a similar requirement in future can utilize that. Of course, please hide senstive field names, data values etc. as you have already done in previously shared images.

I realized too late on the data values and field names… Thank you for reminding.
I will share the final template and how it looks like, and edit the earlier images too.

Had to delete the previous posts due the security reasons.
Reposting the final working report template on how to group data in reports. Thank you @Marc_Dillon

Image on left is the template and that on right is the output.

Hi,

I’ve been reading this thread for a few days now and got my table to group correctly but the way it is setup results to the columns not being aligned. If I put the start and end tags in the table it produces an error where it cant read the column names i put in the cells.

would appreciate any help on this…

Thanks!

Please post screenshots of both the error and your template.

hi Steve,

This is the section of the template I am working on:

here is the error I get:
3X_9_4_945e69b99fe0a759fa3be2267bb692a541267320.png

Is the template you posted the one where the START is inside of the table, and returns that error? What does the other template look like, and what does the outputted file look like?

Hi Marc,

Yes, the one I posted is when the START is inside the table…

If I use the template where the start is outside the table, it looks like this:

Yep, looks familiar. I don’t believe there is any way to get the columns from table to table to line up exactly, but play around with manually setting a value for each column’s width. I’ve also gotten around it before by getting rid of the cell borders so the “jitter” is not so obvious.


Hi @Marc_Dillon,

I would assume that the column width there applies to all columns currently on the table?

It is unfortunate to know that it does not align correctly… but appreciate all the help! Thanks

You should specify a column width for EACH column, by right clicking from any cell in that column.

Hi @Marc_Dillon will try that! Thanks for your help

Top Labels in this Space