Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
chipchidster
Resolver I
Resolver I

Using a parameter in a filter statement in calculated column

I am trying to use a parameter within a filter statement, but no matter what I try I just cannot get it to work.  I'm clearly doing something wrong, but would be grateful if someone can point out what!

 

var planned = SUMX(FILTER(sprint_status_summary,
                        sprint_status_summary[sprint_id] = sprint_summary[sprint_id]
                       && sprint_status_summary[project_key] = sprint_summary[project_key]
                       && sprint_status_summary[start_status] IN VALUES(paramUnreleasedStatus)),
                   // && CONTAINSROW({"Ready For Live","Release Test"}, sprint_status_summary[start_status])),
                   //&& IF(CONTAINSROW(paramUnreleasedStatus, sprint_status_summary[start_status]),TRUE(),FALSE())),
                   sprint_status_summary[story_points])
In the DAX above, you can see the three approaches I have tried.  The first commented out line works (where I explicitly add the contents of paramUnreleasedStatus as a list).  However, if i try and reference the parameter instead (either using direct or using the values function first) the dax returns nothing (the condition of checking the param fails so the sum is always 0).
 
The param is set up as a text list and contains "Ready For Live","Release Test".  If I return the param instead of the calc in the column, i get the list of values correctly.
 
Any thoughts on what i am doing wrong?
3 REPLIES 3
v-yangliu-msft
Community Support
Community Support

Thanks for the reply from bhanu_gautam , please allow me to provide another insight: 
Hi  @chipchidster ,

 

Is the paramUnreleasedStatus you are referring to the Manage Parameters created in the Power Query?

vyangliumsft_0-1738738467045.png

Check the parameter - Enable load - load to table

vyangliumsft_1-1738738467046.png

You can try the following dax:

Test =
SUMX(
    FILTER(ALL('sprint_status_summary'),
   'sprint_status_summary'[sprint_id]=EARLIER('sprint_status_summary'[sprint_id])&&
   'sprint_status_summary'[start_status] in
    SELECTCOLUMNS('paramUnreleasedStatus',"Ready For Live",[paramUnreleasedStatus])),[story_points])

vyangliumsft_2-1738738484045.png

If the results above don't match your expected results, you can express your expected results in the form of a picture and we can help you better!

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

bhanu_gautam
Super User
Super User

@chipchidster , Try using

dax
var planned = SUMX(
FILTER(
sprint_status_summary,
sprint_status_summary[sprint_id] = sprint_summary[sprint_id]
&& sprint_status_summary[project_key] = sprint_summary[project_key]
&& sprint_status_summary[start_status] IN VALUES(paramUnreleasedStatus)
),
sprint_status_summary[story_points]
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Hi Bhanu - I am already trying that logic on line 4 of the example

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.