Calculation to display Selected month and Previous month|| Datetrunc & Dateadd

preview_player
Показать описание
Provide an option to choose month-year to user
and display selected month value and
previous month value

-----
For suppose,
when user selects
May 2018 - need to display may and apr values

Create parameter with date as datatype

Calculated filed to display selected month

datetrunc -
returns the starting value based on the
datepart

order date format: mm/dd/yyyy

dateadd('month',-1,[Choose Month-year]) -
returns previous month

selected month
if DATETRUNC('month',[Order Date])=DATETRUNC('month',[Choose Month-year]) then [Sales] END

previous month
if DATETRUNC('month',[Order Date])=DATETRUNC('month', dateadd('month',-1,[Choose Month-year])) then [Sales] END
Рекомендации по теме
Комментарии
Автор

As a new user, this video was great thanks fo it.
One question, is it possible to set the value of the "Choose Month-Year" from the a dashboard with Actions?
What I want to do is to dynamically set the "Choose Month-Year" value by selecting a bar from a "bar graph" which has data for each month-year value.
Hope I made myself clear about my question.

albertoalarcon
Автор

how to do same when two parameters Dynamically
1.YeaParameter...2012
2.MonthParamter...Aug

Then I need Current month vs prev month sales like "Aug 2012 vs July 2012 sales KPI"
Note: I can do it when single parameter Like Nov 2012 as Single parameter using Datetrunc

praveenprakash
Автор

Can we change the format of the parameter to be list instead of calender??

mohamedabdellatif
Автор

Hello sir I have small doubt if I give current month January 2021 does previous month show Dec 2020

technoscopy
Автор

can you show a video of how you created the month-year parameter?

jessejacob