Forum Discussion
Previous Year Dateadd Excluding Data
When I use this measure:
But when I use this measure by itself:
The former DAX is correctly calculating the Auto row, but it's dropping counts for all the other rows below it. Same thing happens with Previous YTD.
Any ideas? Thank you for your time
- Anonymous2 years ago
Hi mclawler ,
For your total and Auto outside the value is not correct, we can use the ISINSCOPE function, the total for a correct sum, Auto outside the value of some can not get, we can try to use a few more defined variables to get a valid result, I hope my solution is helpful to you!AmountBooked COUNT(Copy) = VAR AutoCount=CALCULATE( COUNT('AutoLoanMatrixDummy'[AmountAdvanced]),'LoanDataDummy'[Product (groups)]="Auto") VAR OtherCount=COALESCE( CALCULATE(COUNT(LoanDataDummy[Amount Booked]),ALLEXCEPT('LoanDataDummy','LoanDataDummy'[Product (groups)])),0) VAR C=CALCULATE(COUNT(LoanDataDummy[Amount Booked]),FILTER('LoanDataDummy','LoanDataDummy'[Product (groups)]="Auto")) RETURN IF( ISINSCOPE('LoanDataDummy'[Product (groups)]), SWITCH( TRUE(), MAX('LoanDataDummy'[Product (groups)])="Auto", AutoCount, OtherCount), AutoCount+OtherCount-C)I have updated your data to the results you need, if you have any other questions you can check the PBIX file I have uploaded, I would be grateful if my solution can help you solve your problem!
Hope it helps!
Best regards,
Community Support Team_ Tom ShenIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.
8 Replies
- Ritaf1983Super User
Hi mclawler
Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.
How to Get Your Question Answered Quickly