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

Group by day in calendar table

Hello, I am quite new on this platform and I need help concerning Power BI!

 

I have a table "users" which indicates the date of creation of users, and a table "messages" which indicates the date of creation of messages. I would like to create a calendar table which would group by day the number of users and the number of messages (see below picture). In my calendar table, what is the formula for calculated columns "number_of_users" and "number_of_messages" ? 

Thanks a lot,

 

Jean-Sebastien

 

demande_aide_power_bi.png

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Champion
Community Champion

Re: Group by day in calendar table

@jeanseb

 

Hi, a solution would be like this:

 

1. Create a New Table (Modeling - New Table):

 

CalendarTable = DISTINCT(UNION(VALUES(Messages[Created at]);VALUES(Users[Created at])))

 

2. Related the 3 tables:

 

related.png

 

 

3. Create 2 calculated Columns:

 

NumberofUsers = COUNTROWS(RELATEDTABLE(Users))+0

NumberofMessages = COUNTROWS(RELATEDTABLE(Messages))+0

 

Ready.




Lima - Peru

View solution in original post

3 REPLIES 3
Highlighted
Community Champion
Community Champion

Re: Group by day in calendar table

@jeanseb

 

Hi, a solution would be like this:

 

1. Create a New Table (Modeling - New Table):

 

CalendarTable = DISTINCT(UNION(VALUES(Messages[Created at]);VALUES(Users[Created at])))

 

2. Related the 3 tables:

 

related.png

 

 

3. Create 2 calculated Columns:

 

NumberofUsers = COUNTROWS(RELATEDTABLE(Users))+0

NumberofMessages = COUNTROWS(RELATEDTABLE(Messages))+0

 

Ready.




Lima - Peru

View solution in original post

Highlighted
Microsoft
Microsoft

Re: Group by day in calendar table

Hi @jeanseb,

If you want to get "number_of_users" and "number_of_messages" every day, you can create a Calendar table using the formula.

Calendar=Calendar(MIN(Table[created_at]),MAX(Table[created_at]))

Then follow up @Vvelarde solution, you will get expected result.

Best Regards,
Angelia

Highlighted
Frequent Visitor

Re: Group by day in calendar table

Thank you very much! 

I wanted to group my data by day, but now I know how to do it! And thank you for your explanation concerning relationships!

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.

Upcoming Events

Upcoming Events

Wondering what events you could join or have an event to promote yourself? Check out our Upcoming Events.

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