<?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 PBI Report Builder - removing duplicate values in parameter dropdown in Report Server</title>
    <link>https://community.fabric.microsoft.com/t5/Report-Server/PBI-Report-Builder-removing-duplicate-values-in-parameter/m-p/3580557#M32045</link>
    <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;I'm currently working through building a paginated report with PBI Report Builder, but a small issue came up. One of my parameters is called Spend Year. Currently, for the sake of working with a faster loading file, I filtered this down to only include the year 2023. However, the issue with this is that the parameter dropdown is displaying multiple options for 2023. I believe it's displaying a 2023 for each row in the dataset that contains one.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;Having multiple options for the same thing just isn't practical, so I've been looking for a way to have the parameter dropdown display distinct options. I managed to find this article:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://www.c-sharpcorner.com/article/remove-duplicate-filter-values-from-ssrs-parameter-drop-down/" target="_blank" rel="nofollow noopener noreferrer"&gt;https://www.c-sharpcorner.com/article/remove-duplicate-filter-values-from-ssrs-parameter-drop-down/&lt;/A&gt;. While this matches my situation, the VB code that he writes is for String values. I'm working with integers. I tried my best to adapt his code to work for integers (you can find the code below), but after following through everything, my Spend Year parameter is now greyed out with no selectable values. I was sure to configure the available values as detailed in the article.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone happen to have any idea how I should go about this? If it's useful to know, my data was pulled via a DAX query.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My version of the code:&lt;/P&gt;&lt;PRE&gt;Public Shared Function RemoveDuplicates(parameter As Parameter) As Integer()
    Dim items As Integer() = parameter.Value
    Array.Sort(items)
    Dim k As Integer = 0
    For i As Integer = 0 To items.Length - 1
        If i &amp;gt; 0 AndAlso items(i) = items(i - 1) Then
            Continue For
        End If
        items(k) = items(i)
        k += 1
    Next
    Dim unique As Integer() = New Integer(k - 1) {}
    Array.Copy(items, 0, unique, 0, k)
    Return unique
End Function&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Tue, 12 Dec 2023 20:06:47 GMT</pubDate>
    <dc:creator>slashdavid</dc:creator>
    <dc:date>2023-12-12T20:06:47Z</dc:date>
    <item>
      <title>PBI Report Builder - removing duplicate values in parameter dropdown</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/PBI-Report-Builder-removing-duplicate-values-in-parameter/m-p/3580557#M32045</link>
      <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;I'm currently working through building a paginated report with PBI Report Builder, but a small issue came up. One of my parameters is called Spend Year. Currently, for the sake of working with a faster loading file, I filtered this down to only include the year 2023. However, the issue with this is that the parameter dropdown is displaying multiple options for 2023. I believe it's displaying a 2023 for each row in the dataset that contains one.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;Having multiple options for the same thing just isn't practical, so I've been looking for a way to have the parameter dropdown display distinct options. I managed to find this article:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://www.c-sharpcorner.com/article/remove-duplicate-filter-values-from-ssrs-parameter-drop-down/" target="_blank" rel="nofollow noopener noreferrer"&gt;https://www.c-sharpcorner.com/article/remove-duplicate-filter-values-from-ssrs-parameter-drop-down/&lt;/A&gt;. While this matches my situation, the VB code that he writes is for String values. I'm working with integers. I tried my best to adapt his code to work for integers (you can find the code below), but after following through everything, my Spend Year parameter is now greyed out with no selectable values. I was sure to configure the available values as detailed in the article.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone happen to have any idea how I should go about this? If it's useful to know, my data was pulled via a DAX query.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My version of the code:&lt;/P&gt;&lt;PRE&gt;Public Shared Function RemoveDuplicates(parameter As Parameter) As Integer()
    Dim items As Integer() = parameter.Value
    Array.Sort(items)
    Dim k As Integer = 0
    For i As Integer = 0 To items.Length - 1
        If i &amp;gt; 0 AndAlso items(i) = items(i - 1) Then
            Continue For
        End If
        items(k) = items(i)
        k += 1
    Next
    Dim unique As Integer() = New Integer(k - 1) {}
    Array.Copy(items, 0, unique, 0, k)
    Return unique
End Function&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 12 Dec 2023 20:06:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/PBI-Report-Builder-removing-duplicate-values-in-parameter/m-p/3580557#M32045</guid>
      <dc:creator>slashdavid</dc:creator>
      <dc:date>2023-12-12T20:06:47Z</dc:date>
    </item>
    <item>
      <title>Re: PBI Report Builder - removing duplicate values in parameter dropdown</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/PBI-Report-Builder-removing-duplicate-values-in-parameter/m-p/3582514#M32069</link>
      <description>&lt;P&gt;For your parameter query, can you add a distinct clause? This will filter down to unique values.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 18:14:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/PBI-Report-Builder-removing-duplicate-values-in-parameter/m-p/3582514#M32069</guid>
      <dc:creator>bradsy</dc:creator>
      <dc:date>2023-12-13T18:14:20Z</dc:date>
    </item>
    <item>
      <title>Re: PBI Report Builder - removing duplicate values in parameter dropdown</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/PBI-Report-Builder-removing-duplicate-values-in-parameter/m-p/3584328#M32077</link>
      <description>&lt;P&gt;Hey, thanks for your response! For some reason the DISTINCT clause was returning an error. I ended up just pulling separate datasets for each parameter to get a list of all unique values that way&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 16:10:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/PBI-Report-Builder-removing-duplicate-values-in-parameter/m-p/3584328#M32077</guid>
      <dc:creator>slashdavid</dc:creator>
      <dc:date>2023-12-14T16:10:16Z</dc:date>
    </item>
    <item>
      <title>Re: PBI Report Builder - removing duplicate values in parameter dropdown</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/PBI-Report-Builder-removing-duplicate-values-in-parameter/m-p/3584736#M32081</link>
      <description>&lt;P&gt;It's probably more efficient to create a separate dataset for each parameter. This is what the query builder will do if you add a parameter using that. The database engine can typically get a distinct list of values much faster than using VBA to loop through the data on the report side&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 22:44:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/PBI-Report-Builder-removing-duplicate-values-in-parameter/m-p/3584736#M32081</guid>
      <dc:creator>d_gosbell</dc:creator>
      <dc:date>2023-12-14T22:44:06Z</dc:date>
    </item>
  </channel>
</rss>

