cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Termigez1
Helper I
Helper I

Displaying values in a nested gallery based on values from other galleries.

Hello, 

 

I have 3 data sources. Table A which is my main table with all the records and all the columns, it looks like this:

 

NameDateValue
Name 101.011
Name 102.012
Name 1 03.013
Name 2 01.011

 

the other 2 tables are Table B which is a list of unique Names from Table A and Table C which is a list of unique Dates from Table A (I am doing it because od delegation issue). 

 

I need to display my data in such way:

 

 01.0102.0103.01
Name 1123
Name 2 123
Name 3111

 

For my needs it must be a vertical gallery (with my unique names from table B as a data source) with a second horizontal gallery nested inside it (I have no idea whether I should use Table A or Table C as a data source)

 

I can imagine that I will create a third horizontal gallery (again with table C as a data source) above both of them with my unique Dates but I really can't find a way to display my Values in the second horizontal gallery that will match corresponding Name from the first gallery and will match the order of Dates from the third gallery. I would really appreciate your help. 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @Termigez1 :

Firstly,A gallery control can only achieve one level of nesting, that is to say, in a sub-gallery, you cannot nest another gallery.

Secondly,If you just want to display the data in the following format, I suggest you use the following method.

 01.0102.0103.01
Name 1123
Name 2 123
Name 3111

My data source:

1.JPG

Solution1:

1\Add a Gallery

Items:

 

TableB

 

2\Add a lable into this gallery

Text

 

ThisItem.Name

 

3\Add a sub-gallery into this gallery

Items

 

Filter(TableA,ThisItem.Name=Name)

 

Or(If you need to sum up Value)

 

AddColumns(GroupBy(Filter(TableA,ThisItem.Name=Name),"Date","TheGroup"),"Value",Sum(TheGroup,Value))

 

4\Add a label into this sub gallery

Text

 

ThisItem.Date

 

5\Add a label into this sub gallery

Text

 

ThisItem.Value

 

2.JPG

Solution2:

1\Add a datatable control and set it's items property to:

 

AddColumns(
    TableB,
    "01.01",
    LookUp(
        TableA,
        Name = TableB[@Name] && Date = "01.01"
    ).Value,
    "02.01",
    LookUp(
        TableA,
        Name = TableB[@Name] && Date = "02.01"
    ).Value,
    "03.01",
    LookUp(
        TableA,
        Name = TableB[@Name] && Date = "03.01"
    ).Value
)

 

Or(If you need to sum up Value)

 

AddColumns(
    TableB,
    "01.01",
    Sum(
        Filter(
            TableA,
            Name = TableB[@Name] && Date = "01.01"
        ),
        Value
    ),
    "02.01",
    Sum(
        Filter(
            TableA,
            Name = TableB[@Name] && Date = "02.01"
        ),
        Value
    ),
    "03.01",
    Sum(
        Filter(
            TableA,
            Name = TableB[@Name] && Date = "03.01"
        ),
        Value
    )
)

 

2.JPG

Best Regards,

Bof

View solution in original post

2 REPLIES 2
eka24
Super User
Super User

Try watching the video

https://youtu.be/EnBpWBb51hs?list=TLPQMjkwNzIwMjBWQhBpO5ffug&t=3

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

v-bofeng-msft
Community Support
Community Support

Hi @Termigez1 :

Firstly,A gallery control can only achieve one level of nesting, that is to say, in a sub-gallery, you cannot nest another gallery.

Secondly,If you just want to display the data in the following format, I suggest you use the following method.

 01.0102.0103.01
Name 1123
Name 2 123
Name 3111

My data source:

1.JPG

Solution1:

1\Add a Gallery

Items:

 

TableB

 

2\Add a lable into this gallery

Text

 

ThisItem.Name

 

3\Add a sub-gallery into this gallery

Items

 

Filter(TableA,ThisItem.Name=Name)

 

Or(If you need to sum up Value)

 

AddColumns(GroupBy(Filter(TableA,ThisItem.Name=Name),"Date","TheGroup"),"Value",Sum(TheGroup,Value))

 

4\Add a label into this sub gallery

Text

 

ThisItem.Date

 

5\Add a label into this sub gallery

Text

 

ThisItem.Value

 

2.JPG

Solution2:

1\Add a datatable control and set it's items property to:

 

AddColumns(
    TableB,
    "01.01",
    LookUp(
        TableA,
        Name = TableB[@Name] && Date = "01.01"
    ).Value,
    "02.01",
    LookUp(
        TableA,
        Name = TableB[@Name] && Date = "02.01"
    ).Value,
    "03.01",
    LookUp(
        TableA,
        Name = TableB[@Name] && Date = "03.01"
    ).Value
)

 

Or(If you need to sum up Value)

 

AddColumns(
    TableB,
    "01.01",
    Sum(
        Filter(
            TableA,
            Name = TableB[@Name] && Date = "01.01"
        ),
        Value
    ),
    "02.01",
    Sum(
        Filter(
            TableA,
            Name = TableB[@Name] && Date = "02.01"
        ),
        Value
    ),
    "03.01",
    Sum(
        Filter(
            TableA,
            Name = TableB[@Name] && Date = "03.01"
        ),
        Value
    )
)

 

2.JPG

Best Regards,

Bof

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (1,363)