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
jeanseb
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
Vvelarde
Community Champion
Community Champion

@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
v-huizhn-msft
Employee
Employee

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

Vvelarde
Community Champion
Community Champion

@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

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