Forum Discussion
Line Chart Visual Disregarding Filters Once Date is Added to X-Axis
- Anonymous2 years ago
Hi karleek ,
I made some changes to the measures:
NumberOfMonths = CALCULATE( DATEDIFF(MIN('Date'[Date]), MAX('Date'[Date]), MONTH) + 1 , ALLSELECTED('Date'))CustomerOrderMonths = CALCULATE( DISTINCTCOUNT('Date'[Month]), FILTER( ALL('Date'), COUNTROWS(RELATEDTABLE('Orders')) > 0 ), VALUES('Orders'[CustomerID]) )Best Regards,
Gao
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Hi karleek ,
Context ultimately affects the counting results of the metric. You may have initially debugged it in the context containing the date. I created a sample model:
NumberOfMonths = CALCULATE( DATEDIFF(MIN('Date'[Date]), MAX('Date'[Date]), MONTH) + 1, ALL('Orders'[CustomerID]),ALLSELECTED('Date'[Date]))CustomerOrderMonths = CALCULATE(DISTINCTCOUNT('Date'[Month]),TREATAS(CALCULATETABLE(VALUES('Orders'[OrderDate]),ALLEXCEPT('Date','Date'[Month])),'Date'[Date]))MatchFilter =
IF(
[NumberOfMonths] = [CustomerOrderMonths],
1,
0
)
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
UPDATE: The visual works properly is I only put in YEAR for the date, but if I try to add in Month or even just add in Month Year that is when it started ignoring the Match filter. Any ideas? Anonymous
Anonymous Thank you for this solution. I had to add a KeepFilter in the Customer Order Month measures since my date slicer will span over 1 year, but otherwise the measures worked. BUT my visual still is not recognizing the Match Filter, it is continuing to display all customers regardless of whether the Match Filter = 1 or not.
- Anonymous2 years agoNot applicable
Hi karleek ,
I made some changes to the measures:
NumberOfMonths = CALCULATE( DATEDIFF(MIN('Date'[Date]), MAX('Date'[Date]), MONTH) + 1 , ALLSELECTED('Date'))CustomerOrderMonths = CALCULATE( DISTINCTCOUNT('Date'[Month]), FILTER( ALL('Date'), COUNTROWS(RELATEDTABLE('Orders')) > 0 ), VALUES('Orders'[CustomerID]) )Best Regards,
Gao
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!How to get your questions answered quickly -- How to provide sample data in the Power BI Forum