Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Help with parameter

Hello,

I have a report calculating how many hours an employee works.  It has a formula that like:

SUM(Regular Hours) + SUM(Extra Hours) - Lunch Deduction.

 

I need to find out from the user what the lunch deduction is, so I"ve created a parameter with values .50, 1.0, 1.5, etc.  But now I don't know how to use this parameter on the report.  How do I display it, and how do I grab the value and add to my formula?

 

Thanks.

  • calerof's avatar
    calerof
    5 years ago

    Anonymous 

    With this code:

    WTF = 
    SUMX(WTF, [Working Hours Total] - 'Lunch Hours'[Lunch Hours Value])

    See here:

    Half hour lunchOne hour lunch

    Works for me. Maybe you could share sample data and your pbix file.

    F

     

10 Replies

  • calerof's avatar
    calerof
    Impactful Individual

    Hi Anonymous ,

    When you create a parameter you'll find it in the Fields pane at the right with a table of one column with a series of values depending on your choice when you created it, and a measure:

    You just have to use that measure in your calculations.

    Regards,

    Fernando

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you Fernando, I must have not created the parameter properly because it is not in my field pane.  From the Power Query Editor Window, I clicked Manage Parameters, then New, and created Lunch Deduction Amount, then hit Close and Apply.  Is there something I am supposed to do after this?

       

       

      • calerof's avatar
        calerof
        Impactful Individual

        In your case you need to use a What If Parameter, which is located under the Modeling ribbon:

        Cheers,

        Fernando