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
Jbmolina93
Frequent Visitor

Create view from table

I have a dataset with columns person, age, department, and date. I'm trying to get the sum of people under the age of 18 grouped by the department from that month. 

Attached is an example data set.

So I want my data to look like this.

 

Person        | Date      | Department A Total | Department B Total |

John Smith | January  |                2               |                  1              |

John Smith | February|                 1              |                  2              |

 

 

example.jpg 

1 ACCEPTED SOLUTION

@Jbmolina93

 

Hi, Try with this

 

MyTable2 =
SUMMARIZE (
    FILTER ( Table1; Table1[Age] < 18 );
    Table1[Name];
    Table1[Date].[Month];
    "Department A Total"; CALCULATE ( COUNT ( Table1[Name] ); Table1[Department] = "A" );
    "Department B Total"; CALCULATE ( COUNT ( Table1[Name] ); Table1[Department] = "B" )
)

Regards

 

Victor

Lima - Peru




Lima - Peru

View solution in original post

3 REPLIES 3
Jbmolina93
Frequent Visitor

I know you can use a matrix to visualize this but what I'm trying to do is get this data on a new table. Dax is not my strong suit yet. 

@Jbmolina93

 

Hi, Try with this

 

MyTable2 =
SUMMARIZE (
    FILTER ( Table1; Table1[Age] < 18 );
    Table1[Name];
    Table1[Date].[Month];
    "Department A Total"; CALCULATE ( COUNT ( Table1[Name] ); Table1[Department] = "A" );
    "Department B Total"; CALCULATE ( COUNT ( Table1[Name] ); Table1[Department] = "B" )
)

Regards

 

Victor

Lima - Peru




Lima - Peru

Thank you so much. This is a simple example that can be implemented in different scenarios.

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.