cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
iamdmitry Frequent Visitor
Frequent Visitor

How calculate quantity difference (distinct count) between row date and selected date

Hello, guys!

 

Please, help me or give me some advice, how calculate quantity difference (distinct count) between row date and selected date.

 

For example, if selected date is 31-1-18:

 

Date       | Distinct Count ID | Diff
31-1-18  | 12                        | 0
01-2-18  | 10                        | -2
02-2-18  | 16                        | 4
03-2-18  | 22                        | 10
04-2-18  | 11                        | -1

 

Dataset is seems like:

Date | ID | Category | Type | Color | etc.

 

I need to create chart with Diff as values and Dates as time axis.
If it's possible, I would like to save possibility to use filtering by columns (Category, Type, Color...)

----------------------------------------------------------

I've calculated two measures like:

 

fixed quantity = calculate(distinctcount(ID), filter(table, Date = Date(2018, 1, 31)))
dynamic quantity = distinctcount(ID)
diff = dynamic quantity - fixed quantity

 

But that approach doesn't work ;-(

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: How calculate quantity difference (distinct count) between row date and selected date

Try:

 

fixed quantity = calculate(distinctcount(ID), filter(ALL(table), Date = Date(2018, 1, 31)))
dynamic quantity = distinctcount(ID)
diff = dynamic quantity - fixed quantity

I have book! Learn Power BI from Packt


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

View solution in original post

1 REPLY 1
Super User
Super User

Re: How calculate quantity difference (distinct count) between row date and selected date

Try:

 

fixed quantity = calculate(distinctcount(ID), filter(ALL(table), Date = Date(2018, 1, 31)))
dynamic quantity = distinctcount(ID)
diff = dynamic quantity - fixed quantity

I have book! Learn Power BI from Packt


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

View solution in original post

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Ask Amanda Anything Q&A

Ask Amanda Anything Q&A

Learn the answers to some of the questions asked during the Amanda Triple A event.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Users Online
Currently online: 142 members 1,545 guests
Please welcome our newest community members: