cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper IV
Helper IV

Count holding data on first of calendar year - Day 1

Hi All,

 

I would like the count of that entire year to remember as Day 1 count for that year,and then count should decrease as we sell that item on that particular date. 

 

I have tried DAX measure as: Count(ID) - TOTALYTD(count(ID),datetable(date)) this is completely wrong

However, it doesnt save as Day 1. Which is something I am looking forward to solve.

Any help is appreciated thanks in advance.

 

Input Data:

IDNameDate Sold
456AAA1/10/20
345SSS1/11/20
267BBB1/12/20
128CCC1/13/20
129EEE1/14/20
125FFF1/15/20
567QQQ1/16/20
678GGG12/20/19

 

Output graph expected as: LINK

 
 
 
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User II
Super User II

Re: Count holding data on first of calendar year - Day 1

@labuser1235 do you always need a current year?

Table 2 = 
ADDCOLUMNS(
CALENDAR(DATE(YEAR(TODAY()), 1, 1), Max('Input Data Table'[Date Sold])),
"Count Items", CALCULATE(DISTINCTCOUNT('Input Data Table'[ID]), FILTER('Input Data Table', 'Input Data Table'[Date Sold] >= EARLIER([Date]) || ISBLANK('Input Data Table'[Date Sold]) ))
) 

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

7 REPLIES 7
Highlighted
Super User II
Super User II

Re: Count holding data on first of calendar year - Day 1

Hi @labuser1235 

create a calculated table

Table 2 = 
ADDCOLUMNS(
CALENDAR(MIN('Input Data Table'[Date Sold]), Max('Input Data Table'[Date Sold])),
"Count Items", CALCULATE(DISTINCTCOUNT('Input Data Table'[ID]), FILTER('Input Data Table', 'Input Data Table'[Date Sold] >= EARLIER([Date])))
) 

 

then put it into chart visual

Снимок.PNG


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Highlighted
Helper IV
Helper IV

Re: Count holding data on first of calendar year - Day 1

This is almost it...just one thing if there are blanks in date sold its not picking the count exactly.

Can you Just fix this one for me in the dax @az38 

 

Highlighted
Super User II
Super User II

Re: Count holding data on first of calendar year - Day 1

@labuser1235 

try

Table 2 = 
ADDCOLUMNS(
CALENDAR(MIN('Input Data Table'[Date Sold]), Max('Input Data Table'[Date Sold])),
"Count Items", CALCULATE(DISTINCTCOUNT('Input Data Table'[ID]), FILTER('Input Data Table', 'Input Data Table'[Date Sold] >= EARLIER([Date]) || ISBLANK('Input Data Table'[Date Sold]) ))
) 

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Highlighted
Helper IV
Helper IV

Re: Count holding data on first of calendar year - Day 1

This is giving us the count for both the years. It should give me the count specific to each year.

In the example given I have provided 2019 and 2020 data which is counting in 2020 and making it as 8. However, as per that specific year count should change. 

IS that in the filter condition are we suppose to give anything where it identifies the year and change its count.

 

Please help me with this we are almost there @az38 

Highlighted
Super User II
Super User II

Re: Count holding data on first of calendar year - Day 1

@labuser1235 

maybe you need this?

Снимок.PNG


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Highlighted
Helper IV
Helper IV

Re: Count holding data on first of calendar year - Day 1

I get that in visual changes, 

 

However I am clubbing it with other things, so if i can have that specifically within the dax as count year wise it would of great help that is why I am requsesting in it. I am trying to make a filter on calculate after the count but it just doesn't take dynamically. Please help me with this @az38 

Highlighted
Super User II
Super User II

Re: Count holding data on first of calendar year - Day 1

@labuser1235 do you always need a current year?

Table 2 = 
ADDCOLUMNS(
CALENDAR(DATE(YEAR(TODAY()), 1, 1), Max('Input Data Table'[Date Sold])),
"Count Items", CALCULATE(DISTINCTCOUNT('Input Data Table'[ID]), FILTER('Input Data Table', 'Input Data Table'[Date Sold] >= EARLIER([Date]) || ISBLANK('Input Data Table'[Date Sold]) ))
) 

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Community Summit Australia – Join Online!

Community Summit Australia – Join Online!

Be a part of the leading Microsoft Business Applications digital event, curated for the APAC community.

Top Solution Authors
Top Kudoed Authors