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
gladies123
Helper I
Helper I

Reg-how to use different two date fields in two different table

Hi,

 

I have a two different table that is table A and table B. i need to use two date field from two different tables but if i enable relationship for that dates Values will be changed. but the thing is if i use revenue date field as slicer  the revenue alone will   change and if i use date as slicer the CTC alone will  change but in tis case i need both revenue and CTC  have to change wiith respect to date which is common to Revenue and CTC

 

Thanks in AdvancePBI ISSUE.PNG

 

1 ACCEPTED SOLUTION
v-zhenbw-msft
Community Support
Community Support

Hi @gladies123 ,

 

If you want to use one date slicer to control two tables, you need to create a date table and create relationships with other tables based on date.

We can use two ways to meet your requirement, one creates a measure, another creates a column in Table B.

 

1. Create a date table and create the relationships.

 

Date = CALENDAR("2020/5/1","2020/6/30")

 

REG1.jpg

 

2. Then create a slicer using it.

 

reg2.jpg

 

The measure solution is to create a measure like this,

 

Measure = 
CALCULATE(SUM('Table A'[Revenue]),FILTER('Table A','Table A'[S.no]=MAX('Table B'[S.no]) && 'Table A'[Revenue Date]=MAX('Table B'[Date])))

 

reg3.jpg

 

The column solution is to create revenue column in Table B.

 

Column = 
CALCULATE(SUM('Table A'[Revenue]),FILTER('Table A','Table A'[S.no]='Table B'[S.no] && 'Table A'[Revenue Date]='Table B'[Date]))

 

reg4.jpg

 

The final result like this,

 

reg5.jpg

 

reg6.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

 

Best regards,

 

Community Support Team _ zhenbw

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

 

BTW, PBIX as attached.

View solution in original post

2 REPLIES 2
v-zhenbw-msft
Community Support
Community Support

Hi @gladies123 ,

 

If you want to use one date slicer to control two tables, you need to create a date table and create relationships with other tables based on date.

We can use two ways to meet your requirement, one creates a measure, another creates a column in Table B.

 

1. Create a date table and create the relationships.

 

Date = CALENDAR("2020/5/1","2020/6/30")

 

REG1.jpg

 

2. Then create a slicer using it.

 

reg2.jpg

 

The measure solution is to create a measure like this,

 

Measure = 
CALCULATE(SUM('Table A'[Revenue]),FILTER('Table A','Table A'[S.no]=MAX('Table B'[S.no]) && 'Table A'[Revenue Date]=MAX('Table B'[Date])))

 

reg3.jpg

 

The column solution is to create revenue column in Table B.

 

Column = 
CALCULATE(SUM('Table A'[Revenue]),FILTER('Table A','Table A'[S.no]='Table B'[S.no] && 'Table A'[Revenue Date]='Table B'[Date]))

 

reg4.jpg

 

The final result like this,

 

reg5.jpg

 

reg6.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

 

Best regards,

 

Community Support Team _ zhenbw

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

 

BTW, PBIX as attached.

amitchandak
Super User
Super User

@gladies123 , You can use a common date table and join with both the tables and use it?

same way common table for the person and Sno, if needed

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-Y...


Appreciate your Kudos.

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.