Forum Discussion

eacy's avatar
eacy
Helper II
9 years ago

Execute user function per row or group

Hi,

 

I have a table with dates and I would like to add a new date row for each month since the first create date until today for each issueid.

I have created a user function which will genereate a new table with all the necesarry new rows but right now it is only executed for the first row in the original table (issueid=225389)

 

Original tabel:

 

M-code:

 

User function m-code:

 

Result is fine but only for one issue id, I need the same for all the issue ids.

 

 

Then I am going to append the two tables.

 

I cannot figure out how to execute the user function for each row where issueid different from next issueid or GroupBy issueid.

 

Any help is appriciated.

4 Replies

  • What do you want to achieve for different user IDs. What is the your expected output. There are many ways to do this in PowerBI.

    • eacy's avatar
      eacy
      Helper II

      Hi Bhavesh,

       

      I want a table like this one.

       

      this one contains one row for each month since the creation date for this specific issue id (225389).

       

      My problem is the user function is only executed one time for the first issue id in the original table. I would like to executed it one time for each of the issues in the original table.

      The business case is that i want to ensure that I have at least one entry per month per issue id. I have arount 1000 different issue ids

      • BhaveshPatel's avatar
        BhaveshPatel
        Super User

        eacy

        As I can see from your M code that you are only filtering the records to get the values of that particular record. 

         

        What user function are you using?? SYNTEX and other details. Posting a Sample data file can help me to demostrate you the different ways. 

         

        It is really confusing to follow the M codes with limited data available.