Forum Discussion
Puja
Helper III
3 years agoPrevious Month Flag
Hi , I need some help with Previous month flag. When user selecta a date Ex: 3/1/2020, the result should be pevious month (2/1/2020) Dates Test data. 1/1/2020 2/1/2020 3/1/2020 4/1/20...
- 3 years ago
Hi,
I am not sure how your datamodel looks like, but please check the below picture and the attached pbix file.
Expected result measure: = VAR _selectedmonthyear = MAX ( Data[Date_test] ) VAR _selectedday = DAY ( _selectedmonthyear ) VAR _prevendofmonthdate = EOMONTH ( _selectedmonthyear, -1 ) RETURN DATE ( YEAR ( _prevendofmonthdate ), MONTH ( _prevendofmonthdate ), _selectedday )
Jihwan_Kim
Super User
3 years agoHi,
I am not sure how your datamodel looks like, but please check the below picture and the attached pbix file.
Expected result measure: =
VAR _selectedmonthyear =
MAX ( Data[Date_test] )
VAR _selectedday =
DAY ( _selectedmonthyear )
VAR _prevendofmonthdate =
EOMONTH ( _selectedmonthyear, -1 )
RETURN
DATE ( YEAR ( _prevendofmonthdate ), MONTH ( _prevendofmonthdate ), _selectedday )
- Puja3 years ago
Helper III
Hi Jihwan_Kim , Thanks a lot for your solution. It is working as expected.
How can I referance your flag in the below measure.
The ask from the user is when he selects a date , it should show previous month actuals. With TREATAS, i am not able to get the correct results.(I have to use TREATAS because there is no relation b/w Date and actuals tables in AAS model)
Actual = CALCULATE([Actual], TREATAS(SUMMARIZE(Forecast,Forecast[Year SF],Forecast[Month SF]),
DimDate[Year],DimDate[Month]))Thank u