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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Surendar88
Frequent Visitor

Optional Parameter usage in DAX

I have a following scenario in Power BI Paginated report. Where two parameters are available. One can be blank and one can have value. Below is the DAX  which is giving the result, but it takes more time as it evaluates blank value. Is there any other approach anyone aware of to evaluate only one parameter which has value and ignore the other which is blank. 

 

DEFINE 
VAR _claim ="ABC"
VAR _policy =""
 

EVALUATE SUMMARIZECOLUMNS 
('Reporting'[Inception Year]
'Reporting'[PolicyNumber]
'Reporting'[InsuredName]

FILTER('Reporting',(_claim= "" ||'Reporting'[ClaimNumber] = _claim))
FILTER('Reporting',(_policy= "" ||Reporting'[PolicyNumber] = _policy)), 

"Premium",'Reporting'[Premium])
order by 'Reporting'[Year] desc 

 

 

 

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi @Surendar88 

The main improvement I would suggest is to filter on the ClaimNumber and PolicyNumber columns rather than the 'Reporting' table.

Something like:

 

DEFINE
    VAR _claim = "ABC"
    VAR _policy = ""

EVALUATE
SUMMARIZECOLUMNS (
    'Reporting'[Inception Year],
    'Reporting'[PolicyNumber],
    'Reporting'[InsuredName],
    FILTER (
        ALL ( 'Reporting'[ClaimNumber] ),
        _claim = ""
            || 'Reporting'[ClaimNumber] = _claim
    ),
    FILTER (
        ALL ( 'Reporting'[PolicyNumber] ),
        _policy = ""
            || 'Reporting'[PolicyNumber] = _policy
    ),
    "Premium", 'Reporting'[Premium]
)
ORDER BY 'Reporting'[Year] DESC

 

There is no way I am aware of to conditionally include/exclude a filter, as conditional tables are not possible.

There could be some other smart approach but this is what I can think of at the moment 🙂

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

View solution in original post

2 REPLIES 2
OwenAuger
Super User
Super User

Hi @Surendar88 

The main improvement I would suggest is to filter on the ClaimNumber and PolicyNumber columns rather than the 'Reporting' table.

Something like:

 

DEFINE
    VAR _claim = "ABC"
    VAR _policy = ""

EVALUATE
SUMMARIZECOLUMNS (
    'Reporting'[Inception Year],
    'Reporting'[PolicyNumber],
    'Reporting'[InsuredName],
    FILTER (
        ALL ( 'Reporting'[ClaimNumber] ),
        _claim = ""
            || 'Reporting'[ClaimNumber] = _claim
    ),
    FILTER (
        ALL ( 'Reporting'[PolicyNumber] ),
        _policy = ""
            || 'Reporting'[PolicyNumber] = _policy
    ),
    "Premium", 'Reporting'[Premium]
)
ORDER BY 'Reporting'[Year] DESC

 

There is no way I am aware of to conditionally include/exclude a filter, as conditional tables are not possible.

There could be some other smart approach but this is what I can think of at the moment 🙂

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

@OwenAuger 

Thankyou so much. It works. I am going to incorporate in my report which has few other parameters as well. I will let you know how it goes. 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.