cancel
Showing results for
Did you mean:
Highlighted
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:

 ID Name Date Sold 456 AAA 1/10/20 345 SSS 1/11/20 267 BBB 1/12/20 128 CCC 1/13/20 129 EEE 1/14/20 125 FFF 1/15/20 567 QQQ 1/16/20 678 GGG 12/20/19

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User II

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

@labuser1235 do you always need a current year?

``````Table 2 =
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

7 REPLIES 7
Highlighted
Super User II

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

create a calculated table

``````Table 2 =
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

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

Highlighted
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

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

try

``````Table 2 =
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

Highlighted
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.

Highlighted
Super User II

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

maybe you need this?

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

Highlighted
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

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

@labuser1235 do you always need a current year?

``````Table 2 =
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

Announcements

#### August 2020 Community Challenge: Can You Solve These?

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

#### Community Blog

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

#### 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