Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Filter visual by date without changing measure

Hello,

 

I have a graph of earnings with columns for monthly earnings and a measure for running total earnings, displayed on the graph as a line. I want to be able to have the visual display just months within the last year, but when I deselect any months in the filters pane it deducts their earnings figures from the value of the total earnings measure. I understand that this is because the measure evaluates in the current filter context. So how can I achieve what I'm looking for? Is it that I need to change the DAX of my measure to ignore that part of the filter context? Would I do that by using ALLSELECTED or something similar? The code for my measure and an image of the graph are below. 

 

Thanks for your help.

 

 

 

Total Earnings = 
CALCULATE(
	[Monthly Earnings],
	FILTER(
		CALCULATETABLE(
			SUMMARIZE(
				'Date Table',
				'Date Table'[Year Month Number],
				'Date Table'[Year Month]
			),
			ALLSELECTED('Date Table')
		),
		ISONORAFTER(
			'Date Table'[Year Month Number], MAX('Date Table'[Year Month Number]), DESC,
			'Date Table'[Year Month], MAX('Date Table'[Year Month]), DESC
		)
	)
)

 

 

 

 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Turns out the solution was just using ALL in place of ALLSELECTED in the DAX above.

3 Replies

  • Anonymous , if you want to filter within the date you have selected you can again filter the data without using allselected , just add the filter

     

    But if you want more range than selected on the axis, then the slicer need to be an independent table 

    Need of an Independent Date Table:https://www.youtube.com/watch?v=44fGGmg9fHI

  • Anonymous's avatar
    Anonymous
    Not applicable

    Turns out the solution was just using ALL in place of ALLSELECTED in the DAX above.

  • v-henryk-mstf's avatar
    v-henryk-mstf
    Community Support

    Hi Anonymous ,

     

    Whether the advice given by amitchandak  has solved your confusion, if the problem has been solved you can mark the reply for the standard answer to help the other members find it more quickly.

     

    If not, please point it out and provide test data, so that I can do further testing.


    Looking forward to your feedback.


    Best Regards,
    Henry