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
Dual Super User
Dual 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

View solution in original post

3 REPLIES 3
Expiscornovus
Dual Super User
Dual 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

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
Dual Super User
Dual 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 😁

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Users online (1,759)