Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jfunderburk
Frequent Visitor

Combine Dates & Count

Hello!

 

I am trying to take a dataset with dates and id numbers for transcations and summarize in to table that count the transcations and receipts that occured on a particular day. Essentialy the issue I am running in to is the dates need to be combined into to one and the distinct count of ids needs to show in a table. The catch is that slicers from the base table still need to be able to apply to this dataset. (In the example set I provided, I would slice by partner in the report if that is what I needed to do).

 

Here is a mock of what the columns coming in that are applicable to my question look lilke.

 

CustomerIDTransIDTransDatePartnerReceiptReceiptReceived
1AA1234561/1/2018A  
2AA1234571/1/2018B  
3AA1234581/1/2018B12341/1/2018
4AA1234591/2/2018A  
5AA1234601/2/2018A12361/3/2018
6AA1234611/2/2018A  
7AA1234621/3/2018B12381/3/2018
8AA1234631/3/2018B12391/10/2018
9AA1234641/3/2018A  
10AA1234651/4/2018A12411/6/2018
11AA1234661/4/2018A  
12AA1234671/6/2018B  
13AA1234681/6/2018B12441/6/2018
14AA1234691/6/2018A  
15AA1234701/7/2018A12461/6/2018
16AA1234711/7/2018A  
17AA1234721/7/2018B  
18AA1234731/7/2018B12491/11/2018
19AA1234741/7/2018A  
20AA1234751/7/2018A12511/7/2018

 

The end result should look something like this:

DateTransactionsReceiptsReceived
1/1/201831
1/2/201830
1/3/201832
1/4/201820
1/5/201800
1/6/201833
1/7/201861
1/8/201800
1/9/201800
1/10/201801
1/11/201801

 

Any and all help is appreciated!

 

-Josh

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

 

You may refer to my solution here.

 

Hope this helps.

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

 

You may refer to my solution here.

 

Hope this helps.

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Both great responses! I went with Ashish's version as it allowed the total columns to work.

 

A follow up question.. how can I create a measure to divide the count of the transactions by the receipts? I guess the UseRelationship functions are giving me trouble when I try to do so. The error said that column cannot be found or used in this calculation.

 

Thanks!

Hi,

 

What happens when you try this measure

 

=[Transactions]/[Receipts received]


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Greg_Deckler
Super User
Super User

I believe that you want measures like this:

 

Transactions = VAR trans = DISTINCTCOUNT([CustomerID])
RETURN IF(ISBLANK(trans),0,trans)

ReceiptsReceived = VAR receipts = CALCULATE(COUNT('#Receipts'[ReceiptReceived]),FILTER(ALL('#Receipts'),'#Receipts'[ReceiptReceived]=MAX('#Receipts'[TransDate])))
RETURN IF(ISBLANK(receipts),0,receipts)

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.