Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Kadrimedquali
Helper I
Helper I

link between two tables by function dax

Hello everybody
please i need your help.

I have two files, dateset1 and dataset 2.

I want to link between the two files, provided that : 

for example i want to divide the total of the date 08/28/2021 in database1 by the fear percentage of each row of the date 28/08/2021 in database 2.

Explanation with pictures

Capture d’écran 2021-09-17 203100.png

I want her Dax function which should I use.

many thanks

fils :

fil excel 

 

file power bi 

 

 

 

 

 

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

HI @Kadrimedquali,

You can try to use the following expression if it suitable for your requirement:

Measure =
VAR currDate =
    MAX ( Table2[Date] )
VAR currPer =
    MAX ( Table2[Percent] )
RETURN
    DIVIDE (
        SUM ( Table2[Value] ),
        CALCULATE (
            SUM ( Table1[Value] ),
            FILTER ( ALLSELECTED ( Table1 ), [Date] = currDate )
        ) * currPer
    )

Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

5 REPLIES 5
v-shex-msft
Community Support
Community Support

HI @Kadrimedquali,

You can try to use the following expression if it suitable for your requirement:

Measure =
VAR currDate =
    MAX ( Table2[Date] )
VAR currPer =
    MAX ( Table2[Percent] )
RETURN
    DIVIDE (
        SUM ( Table2[Value] ),
        CALCULATE (
            SUM ( Table1[Value] ),
            FILTER ( ALLSELECTED ( Table1 ), [Date] = currDate )
        ) * currPer
    )

Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
PaulDBrown
Community Champion
Community Champion

Firstly, create a Date table with unique continuous dates covering the range of dates included in the model. Join this Date table in 1-to-many relationships with both fact tables. Finally use the date table in your visuals, measures, slicers, filters... this makes the DAX straightforward and makes the model efficient 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Kadrimedquali
Helper I
Helper I

Link by date 

ryan_mayu
Super User
Super User

@Kadrimedquali 

the link provided shows access denied.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




I second that. Access denied to both files

Thanks,

Moiz
Was I able to answer your question? Mark my post as a solution to help others. Kudos if you liked the solution.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.