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

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

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 😁

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.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

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.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (1,858)