<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Using a parameter in a function in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-a-parameter-in-a-function/m-p/1996376#M44258</link>
    <description>&lt;P&gt;Let go ( a little bit ) of the idea of a "parameter".&amp;nbsp; Power BI has visuals, these visuals have data feeds, and they respond to user interaction. This user interaction then filters all the visuals, and you can base "measures" on the filter choices.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create a couple of reports to get the hang of it.&amp;nbsp; After that, explore the "What If?" functionality that gives you a ready-made template for modeling behavior.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It helps the other forum users if you provide sample data, and indicate the expected outcome.&lt;/P&gt;</description>
    <pubDate>Wed, 04 Aug 2021 00:14:54 GMT</pubDate>
    <dc:creator>lbendlin</dc:creator>
    <dc:date>2021-08-04T00:14:54Z</dc:date>
    <item>
      <title>Using a parameter in a function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-a-parameter-in-a-function/m-p/1995228#M44211</link>
      <description>&lt;P&gt;Hi, I am trying to create a report that calculates how many units are 'live' in a particular year, with the user being able to select the year and the report updating dynamically when the year is changed. Each set of units in my data can be live in either none, one or many years, so I can't simply assign a year to each and use a slicer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I have tried to do is the following (I am working in DAX rather than the query editor):&lt;/P&gt;&lt;P&gt;I have created columns that calculate the first year and the last year. This then allows me to calculate if any units are live in a particular year with this formula -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;IF(AND(AND([First year]&amp;lt;=2019,[Last year]&amp;gt;2019),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;[Last year]&amp;gt;[First year]),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"Yes",&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"No")&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I can then apply a filter to the table so it only includes the data that returns "Yes" from this formula, giving me the total that I want.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;My idea was to replace 2019 in the formula above with the year selected by the user. I thought this would be possible by creating a parameter and replacing the date in the formula with the parameter value ('Parameter'{Parameter value]), but this doesn't seem to work as it appears to use the default value in the calculation rather than the selected value. I think this may be because DAX does not support using parameters in a formula.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Can anyone help me to think of another approach that might allow me to achieve the desired result?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am still very new to all of this, and I seem to think about things in the wrong way so the approaches I take to solving the problems I encounter are probably not the best!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help or guidance on how I can make this work would be gratefully received. If any extra iinformation would help, please let me know.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: I have updated this post as I initially sumbitted a draft version by mistake!&lt;/P&gt;</description>
      <pubDate>Tue, 03 Aug 2021 17:14:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-a-parameter-in-a-function/m-p/1995228#M44211</guid>
      <dc:creator>jonbrooker</dc:creator>
      <dc:date>2021-08-03T17:14:32Z</dc:date>
    </item>
    <item>
      <title>Re: Using a parameter in a function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-a-parameter-in-a-function/m-p/1996376#M44258</link>
      <description>&lt;P&gt;Let go ( a little bit ) of the idea of a "parameter".&amp;nbsp; Power BI has visuals, these visuals have data feeds, and they respond to user interaction. This user interaction then filters all the visuals, and you can base "measures" on the filter choices.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create a couple of reports to get the hang of it.&amp;nbsp; After that, explore the "What If?" functionality that gives you a ready-made template for modeling behavior.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It helps the other forum users if you provide sample data, and indicate the expected outcome.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Aug 2021 00:14:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-a-parameter-in-a-function/m-p/1996376#M44258</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2021-08-04T00:14:54Z</dc:date>
    </item>
    <item>
      <title>Re: Using a parameter in a function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-a-parameter-in-a-function/m-p/1997394#M44301</link>
      <description>&lt;P&gt;Hi Ibendlin, many thanks for this. I've not explored What If parameters yet so this definitely offers new possibilities!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However I've tried to implement one in my report and am getting the same behaviour as with a parameter. Hopefully the screenshot below helps a bit.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Each row of data has a number of net units and I want to know if they are live in a specific year. I have fields that tell me the first year and the last year that they are live, which are also shown in the table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The filter on the table, Parameter check, is my formula that works out if they are live or not:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Parameter check = IF(AND(AND([First year]&amp;lt;='WhatIF'[WhatIF Value],[Last year]&amp;gt;'WhatIF'[WhatIF Value]),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VALUE([Last year])&amp;gt;VALUE([First year])),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"Yes",&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"No")&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;However you can see from the final column that the WhatIF value that is being used by the formula is not changing with the slider, it is always the default (in this case 2016). I need somehow to get the table to dynamically update to show the rows that return yes from my formula based on the value in the slider.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Is there something else I need to do to make this work? If not, is there a totally different approach I could take that would achieve the desired result?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Many thanks again&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 04 Aug 2021 09:23:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-a-parameter-in-a-function/m-p/1997394#M44301</guid>
      <dc:creator>jonbrooker</dc:creator>
      <dc:date>2021-08-04T09:23:57Z</dc:date>
    </item>
  </channel>
</rss>

