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

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
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:

3. Create 2 calculated Columns:

NumberofUsers = COUNTROWS(RELATEDTABLE(Users))+0

NumberofMessages = COUNTROWS(RELATEDTABLE(Messages))+0

Lima - Peru
3 REPLIES 3
Highlighted
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:

3. Create 2 calculated Columns:

NumberofUsers = COUNTROWS(RELATEDTABLE(Users))+0

NumberofMessages = COUNTROWS(RELATEDTABLE(Messages))+0

Lima - Peru
Highlighted
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!

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.

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

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

Top Solution Authors
Top Kudoed Authors