Forum Discussion
Big_Trucks
5 years agoFrequent Visitor
Conditional filter by importance
Hi All, I have looked extensively for help on this item and have been unable to find something similar. What I want to do is be able to sort out from a table a specific set of rows according to...
- 5 years ago
Hi,
This was a nice one! Please see below how it works. You can select a date, which is used to define the time frame of 6 months. It will then look for accepted quotes, if it does not find any (coalece), it will take the most recent declined quote. Enjoy!
Please note; the date table is unrelated!The DAX code:
_Filter = VAR _selCurrentDate = SELECTEDVALUE ( DateDim[Date] ) VAR _6monthprior = EDATE ( _selCurrentDate, -6 ) RETURN IF ( NOT ( ISBLANK ( SUM ( 'Table'[AMOUNT $] ) ) ), COALESCE ( CALCULATE ( COUNT ( 'Table'[ACCEPTED/DECLINED] ), FILTER ( 'Table', [DATE].[Date] > _6monthprior && [DATE].[Date] <= _selCurrentDate && [ACCEPTED/DECLINED] = "ACCEPTED" ) ), VAR _SELcar = SELECTEDVALUE ( 'Table'[Car Number] ) VAR _MaxDateDeclined = CALCULATE ( MAX ( 'Table'[DATE].[Date] ), FILTER ( ALL ( 'Table' ), [Car Number] = _SELcar && [DATE].[Date] > _6monthprior && [DATE].[Date] <= _selCurrentDate && [ACCEPTED/DECLINED] = "DECLINED" ) ) RETURN CALCULATE ( COUNT ( 'Table'[ACCEPTED/DECLINED] ), FILTER ( 'Table', [DATE].[Date] = _MaxDateDeclined && [Car Number] = _SELcar ) ) ), BLANK () )File is attached.
Kind regards, Steve.
Big_Trucks
5 years agoFrequent Visitor
stevedepThank you so much for the help. You are directionally where I need to be headed. I think slight tweaks will to your outline will work for me. I hadn’t even thought to break it down with date VARs. That really helped to go line by line as needed. I know it was a bit of a complex problem, but you nailed it. Thanks again.
stevedep
5 years agoMemorable Member
Welcome! I enjoy the complex problems the most 🙂