Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Help with delegation filtering for Date Range

(0) ShareShare
ReportReport
Posted on by 141
Hello,
 
i have a Gallery with code below in its item's Property..
Displaying the days of actual month + Teams (Anzeigetext) and collecting Projects assigned to specific day and team (Dataverse Table), either Start_Date on the day, or longer project and its Project duration on it..
 
AddColumns(
    Sequence(
        Day(
            DateAdd(
                DateAdd(
                    Date(
                        Year(var_date);
                        Month(var_date);
                        1
                    );
                    1;
                    TimeUnit.Months
                );
                -1;
                TimeUnit.Days
            )
        );
        0;
        1
    );
    Datum;
    var_date + Value;
    Gewerk;
    ThisItem.Leistungsfeld;
    Ausführende;
    ThisItem.Anzeigetext;
    ID;
    Concatenate(
        ThisItem.Anzeigetext;
        "-";
        var_date + Value
    );
    Projekte;
    Filter(
        Sort(
            Filter(
                Partie_Einteilung_Database;
                Partie = ThisItem.Anzeigetext;
                !IsBlank(Umsetzungsdauer)
            );
            Start_Date;
            SortOrder.Descending
        );
        Start_Date <= DateAdd(
            var_date;
            Value
        ) && calc_end_Date > DateAdd(
            var_date;
            Value
        )
    );
    Anmerkung;
    Filter(
        Sort(
            Filter(
                Partie_Einteilung_Database;
                Partie = ThisItem.Anzeigetext;
                !IsBlank(new_anmerkungen)
            );
            Start_Date;
            SortOrder.Descending
        );
        Start_Date = DateAdd(
            var_date;
            Value
        )
    )
)
 
the DateAdd in the filter for "Projekte" is not delegable are there other ways how i could solve this?
I had other versions of this code:
 
Start_Date <= (var_date + Value&&
(Start_Date + Umsetzungsdauer) [instead of calc_end_Date] > (var_date + Value)
 
in this case only (Start_Date + Umsetzungsdauer) was marked to have delegation problems,
so i decided to exchange it with a Dataverse column and do the calculation there, so the new formular looked like that:
 
Start_Date <= (var_date + Value&&
calc_end_Date > (var_date + Value)
 
using this formular i then got a runtime error on labels in the gallery, but not in the code it self:
 
A binary operator with incompatible types was detected. Found operand types 'Edm.DateTimeOffset' and 'Edm.Int32' for operator kind 'Add'.
 
 
Is there a way to solve this - getting it non delegable and not getting any error 
 
Categories:
  • TSte Profile Picture
    TSte 141 on at
    Help with delegation filtering for Date Range
    Thanks!
    Did need a little adaption, but basically that way the delegation problems where solved!
     
    best regrads
    Thomas
  • WarrenBelz Profile Picture
    WarrenBelz 145,580 on at
    Help with delegation filtering for Date Range
    I have had another attempt at the structure - as noted before, this is really to give you an idea of a possible way to manage the Delegation issue - I cannot see your data, so some elements may not be correct.
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee
  • TSte Profile Picture
    TSte 141 on at
    Help with delegation filtering for Date Range
    hi, and thank you very much for that fast response!
     
    unfortunately its arguing about Value
    it says name invalid, Value not recognized..
     
  • Verified answer
    WarrenBelz Profile Picture
    WarrenBelz 145,580 on at
    Help with delegation filtering for Date Range
    I have tried to make this Delegable - note free-typed, so watch brackets, separators etc
    AddColumns(
       AddColumns(
          Sequence(
             Day(
                DateAdd(
                   DateAdd(
                      Date(
                         Year(var_date);
                         Month(var_date);
                         1
                      );
                      1;
                      TimeUnit.Months
                   );
                   -1;
                   TimeUnit.Days
                )
             );
             0;
             1
          );
          _Date;
          DateAdd(
            var_date;
            Value
          );
          _Partie;
          Sort(
             Filter(
                Partie_Einteilung_Database;
                Partie = ThisItem.Anzeigetext
             );
             Start_Date;
             SortOrder.Descending
          )
       );
       Datum;
       _Date;
       Gewerk;
       ThisItem.Leistungsfeld;
       Ausführende;
       ThisItem.Anzeigetext;
       ID;
       ThisItem.Anzeigetext & "-" & _Date;
       Projekte;
       Filter(
          _Partie;
          Start_Date <= _Date;
          calc_end_Date > _Date;
          !IsBlank(Umsetzungsdauer)
       );
       Anmerkung;
       Filter(
          _Partie;
          Start_Date <= _Date;
          !IsBlank(new_anmerkungen)
       )
    )

    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,580

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,909

Leaderboard