Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
aheavy95
Creator
Creator

monthly gap in measure

Hi all,

I have built a graph that shows the total amount of users (blue) and the number of new users that have joined each month (red)

 

aheavy95_0-1664800452185.png

I calculated the number of new users each month as the gap between the total users between this and the previous month in the following way:

 

(RangeSum(Above( total count(distinct

{<UserBirthDate={*}>}
UserKey), 0, RowNo(total))))
-
above(RangeSum(Above( total count(distinct
{<UserBirthDate={*}>}
UserKey), 0, RowNo(total))))

this formula basically uses the calculation of the total amount of users and subtracts the total from the previous year-month dimension value.

The problem is that for example when I filter year 2022 only, as is shown in the screenshot, I get no value for the New users amount in 2022-01 because the previous month( 2021-12) does not appear in the graph, and I still wish to see this value. 

Does anyone have an idea of a calculation that will show the New users measure as I wish?

Thanks 

 

Labels (6)
1 Reply
Mario_De_Felipe
Luminary
Luminary

If you have a reference Date field you have to include it in your set expression, forcing to include previous month. something like this:

(RangeSum(Above( total count(distinct

{<UserBirthDate={*}>}
UserKey), 0, RowNo(total))))
-
above(RangeSum(Above( total count(distinct
{<UserBirthDate={*},MasterDate={">=$(=MonthStart(AddYears(MasterDate,-1)))<=$(=Date(Max(MasterDate))"}>}
UserKey), 0, RowNo(total))))