web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Createing a collection...
Power Apps
Suggested Answer

Createing a collection for Line chart

(1) ShareShare
ReportReport
Posted on by 271
Hello,
I am trying to merge and create a a collection from a sharepoint list 
 
first collection has distribution of a fund between a start and end date,
 
I have project status in a sharepoint list ( which has the name of the project and the status date, and financila information
 
In power app I am trying to create a collection which merges these 2 in another collection using following formula 
ClearCollect(
    ColTest,
    AddColumns(
        g1,
        _Financial,
 
       If(IsBlank( LookUp('Project Status','Status Month'=Text( g1[@_Month])&&'Status Year'.Value=Text(g1[@_Year])&&ProjName=g1[@ProjectName],'Payments Current Month')),""
           ,Value(LookUp('Project Status','Status Month'=Text(g1[@_Month])&&'Status Year'.Value=Text( g1[@_Year])&&ProjName=g1[@ProjectName],'Total Payments')))))
 
and it generate the following collection 
I need to fill in the empty values with the last number, so if the value for 4/1/2025 and 5/1/2025 is empty, just add 3/1/2025 value=130000 so that my chart doesn't show 0 for those dates and show straight line rather
 
Thank you so much!
 
Categories:
I have the same question (0)
  • Suggested answer
    tsa-svd2srv Profile Picture
    204 on at
    I don't know if I'm helping, or just making code look pretty. Let's give a shot though:
     
    In your If function, you ask "If 'Payments Current Month' is blank, return blank.
    If(
                IsBlank(
                    LookUp(
                        'Project Status',
                        'Status Month' = Text(g1[@_Month]) &&
                        'Status Year'.Value = Text(g1[@_Year]) &&
                        ProjName = g1[@ProjectName],
                        'Payments Current Month'
                    )
                ),
                "",
     
    Then, if its not blank, return , 'Total Payments'.
    Value(
                    LookUp(
                        'Project Status',
                        'Status Month' = Text(g1[@_Month]) &&
                        'Status Year'.Value = Text(g1[@_Year]) &&
                        ProjName = g1[@ProjectName],
                        'Total Payments'
                    )
                )
    If what you want is to check to see is 'Payments Current Month' is blank, the return, 'Total Payments'
    If(
                IsBlank(
                    LookUp(
                        'Project Status',
                        'Status Month' = Text(g1[@_Month]) &&
                        'Status Year'.Value = Text(g1[@_Year]) &&
                        ProjName = g1[@ProjectName],
                        'Payments Current Month'
                    )
                ),
                Value(
                    LookUp(
                        'Project Status',
                        'Status Month' = Text(g1[@_Month]) &&
                        'Status Year'.Value = Text(g1[@_Year]) &&
                        ProjName = g1[@ProjectName],
                        'Total Payments'
                    )
                )
     
    And if 'Payments Current Month' is not blank, then return 'Payments Current Month', the whole code would be:
    If(
                IsBlank(
                    LookUp(
                        'Project Status',
                        'Status Month' = Text(g1[@_Month]) &&
                        'Status Year'.Value = Text(g1[@_Year]) &&
                        ProjName = g1[@ProjectName],
                        'Payments Current Month'
                    )
                ),
                Value(
                    LookUp(
                        'Project Status',
                        'Status Month' = Text(g1[@_Month]) &&
                        'Status Year'.Value = Text(g1[@_Year]) &&
                        ProjName = g1[@ProjectName],
                        'Total Payments'
                    )
                ),
                Value(
                    LookUp(
                        'Project Status',
                        'Status Month' = Text(g1[@_Month]) &&
                        'Status Year'.Value = Text(g1[@_Year]) &&
                        ProjName = g1[@ProjectName],
                        'Payments Current Month'
                    )
                 )
            )
     
    Below is the same code, but pretty:
    ClearCollect(
        ColTest,
        With( //Let's cache the LookUp as projectStatus
            {
                projectStatus: LookUp(
                    'Project Status',
                    'Status Month' = Text(g1[@_Month]) &&
                    'Status Year'.Value = Text(g1[@_Year]) &&
                    ProjName = g1[@ProjectName]
                )
            },
            AddColumns(
                g1,
                "_Financial",
                If(
                    IsBlank(projectStatus.'Payments Current Month'),
                    Value(projectStatus.'Total Payments'),
                    Value(projectStatus.'Payments Current Month')
                )
            )
        )
    )
     
    Let mw know if any of this worked or at least helped.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 610

#2
Haque Profile Picture

Haque 317

#3
WarrenBelz Profile Picture

WarrenBelz 315 Most Valuable Professional

Last 30 days Overall leaderboard