Forum Discussion
Newbie with a problem understanding code.
- Anonymous2 years ago
Hi, peraleonardo
Thank you very much for your reply. This is true if you intend to take all dates into account in your calculations without taking into account any filters applied elsewhere in the report.
ALL ( 'table'[date])However, if you wish to keep some filters, you may need to adjust this part of the formula. You should try using ALLEXCEPT to keep the other filters in your matrix.
ALLEXCEPT function (DAX) - DAX | Microsoft Learn
KEEPFILTERS function (DAX) - DAX | Microsoft Learn
It would be helpful if you could make some virtual data and describe the output that you are looking forward to, it would help me understand your problem.
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Jianpeng Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks solutions from xifeng_L and mark_endicott
Hi, peraleonardo
ALL ( 'table'[date])
Here the filter is used to apply the condition to all rows in the Table. The all function removes any filters that may be applied to the Date column of the Table, ensuring that all dates are taken into account in the calculation.
'table'[date] = MAX('table'[date]) && 'table'[date] <= TODAY()
This condition in the FILTER is to find dates in the Table that are both the largest date (the most recent date in the data) and less than or equal to today's date.
You can click on the drop-down link to learn the basics of the DAX:
Learn DAX basics in Power BI Desktop - Power BI | Microsoft Learn
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Jianpeng Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- peraleonardo2 years agoNew Member
Hi,
Understood but I also have another consideration. When I try to modify the second condition and insert:
'table'[date] <= MAX(DATE(yyyy,mm,dd)) I always get in the matrix the maximum date like if the filter apply by the matrix itself it's not working.
how can you help me out with this?
- Anonymous2 years agoNot applicable
Hi, peraleonardo
Thank you very much for your reply. This is true if you intend to take all dates into account in your calculations without taking into account any filters applied elsewhere in the report.
ALL ( 'table'[date])However, if you wish to keep some filters, you may need to adjust this part of the formula. You should try using ALLEXCEPT to keep the other filters in your matrix.
ALLEXCEPT function (DAX) - DAX | Microsoft Learn
KEEPFILTERS function (DAX) - DAX | Microsoft Learn
It would be helpful if you could make some virtual data and describe the output that you are looking forward to, it would help me understand your problem.
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Jianpeng Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.