The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hello,
I am new to DAX functionality and I was wondering if there were functions and measures I could create to make the following psuedo code possible:
If (Table 1 Value exists in Table 2) {
If (Table 1 Value's Entry Date is after Table 2 Value's Entry Date) {
[Do Something]
}
}
The main issues I have are in regards to setting up the conditionals. Are there DAX functions to see if Values exist in different tables? And is there a logical comparison between dates to see if one date is after another date?
Thanks
Hi, @Anonymous
I tried to create a sample pbix file based on the explanation.
I am not sure whether I understood your question correctly, but please check the below picture and the sample pbix file.
Table1 Value exists in Table2 =
IF (
ISFILTERED ( Dim_Values[Value] ),
SWITCH (
TRUE (),
SELECTEDVALUE ( Table1[Value] )
IN CALCULATETABLE ( VALUES ( Table2[Value] ), ALL ( Dim_Values ) )
&& SELECTEDVALUE ( Table1[Date] ) > SELECTEDVALUE ( Table2[Date] ), "Yes / later than table2",
SELECTEDVALUE ( Table1[Value] )
IN CALCULATETABLE ( VALUES ( Table2[Value] ), ALL ( Dim_Values ) )
&& SELECTEDVALUE ( Table1[Date] ) <= SELECTEDVALUE ( Table2[Date] ), "Yes / earlier(or equal) than table2",
SELECTEDVALUE ( Table1[Value] ) = BLANK ()
&& SELECTEDVALUE ( Table2[Value] ) <> BLANK (), "Only Table2",
NOT (
SELECTEDVALUE ( Table1[Value] )
IN CALCULATETABLE ( VALUES ( Table2[Value] ), ALL ( Dim_Values ) )
), "Only Table1"
)
)
https://www.dropbox.com/s/r72e077i33gpve9/kesera.pbix?dl=0
Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
Linkedin: linkedin.com/in/jihwankim1975/
Twitter: twitter.com/Jihwan_JHKIM
User | Count |
---|---|
26 | |
10 | |
8 | |
6 | |
6 |
User | Count |
---|---|
32 | |
14 | |
10 | |
10 | |
9 |