cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
nich3play3r
Advocate II
Advocate II

Need current fiscal year int to pass as parameter value to paginated report

Hi.

 

I have a flow that executes a paginated report. The report has 2 parameters, one of which is FiscalYear. I'm trying to create an expression to give me the current fiscal year as an integer, but I keep getting errors. Here's what I currently have:

 

if(int(formatDateTime(utcNow(),'MM')) > 6, int(formatDateTime(utcNow(),'yyyy')) + 1, int(formatDateTime(utcNow(),'yyyy')))

 

Maybe I need to pursue a different strategy? Thanks for any thoughts you may have!

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User
Super User

Hi @nich3play3r,

 

You are pretty close to the solution. Just replace > and + by the greater and add functions. You can also remove the formatdatetime and directly put the format within the UtcNow function

 

Try the expression below instead:

 

 

if(greater(int(utcNow('MM')), 6), add(int(utcNow('yyyy')), 1), int(utcNow('yyyy')))

 

 

 

fiscalyear.png



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


View solution in original post

3 REPLIES 3
Expiscornovus
Super User
Super User

Hi @nich3play3r,

 

You are pretty close to the solution. Just replace > and + by the greater and add functions. You can also remove the formatdatetime and directly put the format within the UtcNow function

 

Try the expression below instead:

 

 

if(greater(int(utcNow('MM')), 6), add(int(utcNow('yyyy')), 1), int(utcNow('yyyy')))

 

 

 

fiscalyear.png



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Thank for you for this, @Expiscornovus . This value is such a common need for me, I should really take the time to document its creation across all the languages I'm frequently dabbling in. Also, a follow up, if you have time:

 

I see you're doing this as an variable. I went straight for a Compose step, though I suppose I could also simply add your expression directly into my ParametervaluesValue box in my Export to File For Paginated Reports step. Would initializing a variable still be your recommedation, given these other options?

 

Thank you again for your time and your clear, concise answer.

Expiscornovus
Super User
Super User

Hi @nich3play3r,

 

Yes, you should be able to use the expression directly into the parametervalues box/field.

 

You do not need a compose or initialize variable action. My screenshot was just an example 😁



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Users online (3,590)