Forum Discussion
Anonymous
3 years agoNot applicable
Dynamic previous month data
Hi , I need to create a dynamic previous month showing data in power bi I have date column in Fact table as "date" I also have views col as "views" in Fact table I have type name col in Dim t...
Sahir_Maharaj
3 years agoSuper User
Hello Anonymous,
Use the following DAX formula to calculate the count of views for the previous month:
Prev Month Count =
VAR SelectedMonth = SELECTEDVALUE('Fact table'[date])
VAR PreviousMonth = EDATE(SelectedMonth, -1)
RETURN
CALCULATE(
COUNT('Fact table'[views]),
'Fact table'[date] = PreviousMonth,
'Dim table'[Type] IN {"News", "Reminders", "Good to know"}
)Let me know if you might need further assistance.