Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

running bar chart from previous month-year forwards

I have chart which shows forthcoming maintenance tasks:

however rather than showing all months we only want to show data from the previous month onwards.

So in this scenario I only want to see in the bar chart data from Aug-2015 onwards.

chart.jpg

I've played about the variables and the expression but not cracked this yet!

the chart dimension is "MonthYear"

the expression is : =count(DISTINCT {<probtype_cat={'PPM'}>} [Work Request Code])

I've variables for current month & current year i.e. "let vCurrentMonth = month(today())" & "let vCurrentYear = year(today())"

7 Replies
sinanozdemir
Specialist III
Specialist III

HI Dan,

Maybe try something like the below:

count(DISTINCT {<probtype_cat={'PPM'}, MonthYear = {">=$(Date(Today(), 'MMM-YYYY'))"}>} [Work Request Code])


Edit: Sorry, you said previous month and on so try the below:


count(DISTINCT {<probtype_cat={'PPM'}, MonthYear = {">=$(AddMonths(Date(Today(), 'MMM-YYYY'), -1))"}>} [Work Request Code])


Hope this helps.

sasiparupudi1
Master III
Master III

try

count(DISTINCT {<probtype_cat={'PPM'}, MonthYear = {">=$(Date(AddMonths(Today(), -1),'MMM-YYYY'))"}>} [Work Request Code])

sinanozdemir
Specialist III
Specialist III

SasiParupudi1‌ got it right...

Not applicable
Author

Sorry still does come up right, it shows all months of the year not from last month onwards:

chart2.jpg

expression is: =Count(DISTINCT {<probtype_cat={'PPM'}, MonthYearToPerform={">=$(Date(AddMonths(Today(),-1),'MMM-YYYY'))"}>} [Work Request Code])

sinanozdemir
Specialist III
Specialist III

Is your MonthYearToPerform dimension formatted as text or date? Would you mind posting some sample data?

Not applicable
Author

Hi,

Please try using calculated dimension for the MonthYear instead of MonthYear.

if(MonthYear >= (Date(AddMonths(Today(),-1),'MMM-YYYY')), MonthYear, Null())


Hope this help.

Regards,

Vivek Singh

Not applicable
Author

we use a QVD loader file, which includes generic date/calendar scripts for various date fields from our source application, for MonthYearToPerform it uses as follows:

// Generate Final Calendar
LOAD
[$(_field)]
,
year([$(_field)]) as [Year$(_prefix)]
,
month([$(_field)]) as [Month$(_prefix)]
,
day([$(_field)]) as [Day$(_prefix)]
,
weekday([$(_field)]) as [WeekDay$(_prefix)]
,
Date(MonthStart([$(_field)]),'MMM-YYYY') as [MonthYear$(_prefix)]