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
TaufikMaggangka
Helper II
Helper II

Create new table from two table and group by year

Hi Expert,

Need help to create new table(Not by data trasformation but by virtual table), to combine two table into one table. 
Here the illustrationL

Class Table

YearSchoolIdClassName
20211A
20211B
20211C
20211D
20211E
20211F
20212G
20212H
20212I
20212J
20212K
20212L
20221AA
20221AB
20221AC
20222BA
20222BB
20222BC

 

Date Table
Table that contain date from 2021 to 2022.

Basically I want to combine the two table and filtering by year, so the class in 2021 will only show in 2021, same with class in 2022 when we generating the new table.

Thank so much for help, stuck few days with this. quite new with power bi. If need more explanation let me know

2 ACCEPTED SOLUTIONS
Icey
Community Support
Community Support

Hi @TaufikMaggangka ,

 

Do you mean something like so?

Table =
FILTER ( CROSSJOIN ( Class, 'Date' ), Class[Year] = YEAR ( 'Date'[Date] ) )

Icey_0-1649664852569.png

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Hi @TaufikMaggangka ,

 

Try this:

Table =
FILTER (
    CROSSJOIN (
        SUMMARIZE ( Class, Class[SchoolId], Class[Classid], Class[Year] ),
        'Date'
    ),
    Class[Year] = YEAR ( 'Date'[Date] )
)

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Icey
Community Support
Community Support

Hi @TaufikMaggangka ,

 

Do you mean something like so?

Table =
FILTER ( CROSSJOIN ( Class, 'Date' ), Class[Year] = YEAR ( 'Date'[Date] ) )

Icey_0-1649664852569.png

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @Icey , 
related to this approach, it is working fine. But I have an issue.
Is there a way to do it, If want to only retrive only specific column in both table. I try this way but it is merged all field on the both table. in my case My table more complicated, If I follow your way, it is increase the size of the power bi file, and the performance being slowly.

for example, Table Class.

School IDClassIDClassNameYear
11A2021
12B2021
13C2022
211AA2021
222BB2022
233CC2022
3111AAA2021
3222BBB2021


In this case, I only want to retrive SchoolId, and Classid and not including classname.

Really need your help,
I try to modified your dax, but cannot solve it.

Hi @TaufikMaggangka ,

 

Try this:

Table =
FILTER (
    CROSSJOIN (
        SUMMARIZE ( Class, Class[SchoolId], Class[Classid], Class[Year] ),
        'Date'
    ),
    Class[Year] = YEAR ( 'Date'[Date] )
)

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks @IceyThank you so much. this is work.

daXtreme
Solution Sage
Solution Sage

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.

Top Solution Authors