Forum Discussion
Optional Parameter usage in DAX
- 4 years ago
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] DESCThere 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
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
- Surendar884 years agoFrequent Visitor
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.