The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi, experts, I have two tables, dimension table and fact table, I created a filter use column from dimension table, but fact table may not exist some values in dimension table, and I need to make sure all the values from the fiters selected has relevant data, do you have any ideas?
My idea is that creat a measure in the dimension table, when the value from fact table exist in dimension table, then return 1, else 0, and apply this measure to the filter, but the measure crteated is not work.
here is the sample data and expected result:
dimsention table
region |
A |
B |
C |
fact table
region | data |
A | adaf |
C | fadfa |
expected result:
region | measure |
A | 1 |
B | 0 |
C | 1 |
I created mesure like this:
measure=
VAR _fact=MAX('fact'[region])
Solved! Go to Solution.
Hi @Anonymous ,
(1) We can create a calculated column.
Column = IF('Fact Table'[region]=RELATED('Dimension table'[region]),1,0)
(2)We can create a measure.
Measure = IF(SELECTEDVALUE('Fact Table'[Column])==BLANK(),0,1)
(3) Then the result is as follows.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
According to your description, here are my steps you can follow as a solution.
(1) My test data is the same as yours.
(2) We can create a measure.
Measure = IF(LOOKUPVALUE('dimsention table'[region],'fact table'[region],MAX('dimsention table'[region])) ==BLANK(),0,1)
(3) Then the result is as follows.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks, the sample data maybe too simple and some problems might hidden.
If I add a row of data in fact table {C, aaa}, and the required relationship is 1-n, there would be an error, and I tried many times with this method
here is the fact table and relationship, and relevant error:
fact table added one record:
relationship:
error:
Hi @Anonymous ,
(1) We can create a calculated column.
Column = IF('Fact Table'[region]=RELATED('Dimension table'[region]),1,0)
(2)We can create a measure.
Measure = IF(SELECTEDVALUE('Fact Table'[Column])==BLANK(),0,1)
(3) Then the result is as follows.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for your explanation, did you get an error when creating column? Actually there is always an error when I create a column like that, it says parameter is not the correct type
Hi @Anonymous ,
You should create calculated columns and measures on the fact table, as shown in my picture.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
Please find the below solution.
Best Regards,
Shreya
Appreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!
I did not get the result use this column, there is aloway an error with RELATED function,
maybe because the data is imported?
User | Count |
---|---|
29 | |
12 | |
8 | |
7 | |
5 |
User | Count |
---|---|
36 | |
14 | |
12 | |
7 | |
7 |