Forum Discussion
Current month values with DAX
Hi,
I have created a new measure which shows values for the whole year, however I also want to have a measure where I can only see values for current month. The current measure I have is called "Overall Gain"
Please can anyone help with this. I am still very much a novice and would appreciate any help.
Many thanks
7 Replies
- devinsoniRegular Visitor
The easiest way to do this is to put a filter on your visual for Date and click Relative Filtering. Then you can select "In this current month" and that visual/table will always show the data for the current month of current year.
- NLEIGHHelper I
Many thanks, I will try this and let you know if works !
- ryan_mayuSuper User
could you pls provide some sample data and expected output?
- NLEIGHHelper I
Many thanks for taking the time to reply, however I think I may have a solution from a suggestion from another member.
- AnonymousNot applicable
Hi NLEIGH ,
Maybe you can try formula like below:
Overall Gain = SUM('Table'[SalesAmount])Current Month Gain = CALCULATE( [Overall Gain], FILTER( ALL('Date'), 'Date'[Year] = YEAR(TODAY()) && 'Date'[Month] = MONTH(TODAY()) ) )Whole Year = CALCULATE ( SUM ( 'Table'[SalesAmount] ), YEAR ( 'Date'[Date] ) = YEAR ( TODAY () ) )
Best Regards,
Adamk KongIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- NLEIGHHelper I
Hi Adam,
Many thanks for taking the time to reply and give a detailed answer. However I think I now have a solution from another member. I appreciate your time & effort.
- AnonymousNot applicable
Hi NLEIGH ,
If the issue has been resolved, would it be possible to mark it as resolved and I look forward to your feedback.
Best regards,
Adamk Kong