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

3 Fact tables with same structure but different usage of dates

Dear all,

 

Considering i have 3 fact tables, each with different date, but similar structure

Claim IDUnderwriting DateLoss Incurred
12018011000
2201802200
32018035000
   
Claim IDAccident DateLoss Incurred
12018021000
2201803200
32018045000
   
Claim IDCalendar DateLoss Incurred
12018031000
2201803200
32018045000

 

I am using direct query to database to retrieve this data.

I would like to have a filter that specifies which date view (calander, underwriting, loss). Once i click on the filter, the loss incurred or any other relevant field will reflect accordingly.

 

Any suggestion besides of union the 3 tables and create the type?

 

Regards

CS

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Create a new table with the union of all and unpivot the Date column in a hack-ish way
Claims =
UNION(
   SELECTCOLUMNS(ClaimTbl_1, "Claim ID", ClaimTbl_1[Claim ID], "Date", "Underwriting Date", "Loss Incurred", ClaimTbl_1[Loss Incurred]),
   SELECTCOLUMNS(ClaimTbl_2, "Claim ID", ClaimTbl_2[Claim ID], "Date", "Accident Date", "Loss Incurred", ClaimTbl_2[Loss Incurred]),
   SELECTCOLUMNS(ClaimTbl_3, "Claim ID", ClaimTbl_3[Claim ID], "Date", "Calendar Date", "Loss Incurred", ClaimTbl_3[Loss Incurred])
)

Original solution found here:
https://stackoverflow.com/questions/50213905/is-it-possible-to-unpivot-in-power-bi-using-dax

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Create a new table with the union of all and unpivot the Date column in a hack-ish way
Claims =
UNION(
   SELECTCOLUMNS(ClaimTbl_1, "Claim ID", ClaimTbl_1[Claim ID], "Date", "Underwriting Date", "Loss Incurred", ClaimTbl_1[Loss Incurred]),
   SELECTCOLUMNS(ClaimTbl_2, "Claim ID", ClaimTbl_2[Claim ID], "Date", "Accident Date", "Loss Incurred", ClaimTbl_2[Loss Incurred]),
   SELECTCOLUMNS(ClaimTbl_3, "Claim ID", ClaimTbl_3[Claim ID], "Date", "Calendar Date", "Loss Incurred", ClaimTbl_3[Loss Incurred])
)

Original solution found here:
https://stackoverflow.com/questions/50213905/is-it-possible-to-unpivot-in-power-bi-using-dax

PSBR
Frequent Visitor

Better you change all date field name as a date after that merge all table into one new table. because of all tables having same fields.

I am using direct query, so union cant work unless import?

Thats why asking if there is any other way to do it.

 

Also, i want a 2 filters, 1 filter to show date range, another filter to differentiate the type(calender view, underwriting view, loss view).

Anonymous
Not applicable

Do you have a Date table linking the 3 fact tables up? I would have thought using that Date table as your filter should flow to the other tables.

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.