Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi all,
I have Fact and Dimension Table. I'm querying the cube using DAX code. I want to get all the values from dimension table irrespective they have value in Fact. Currenlty because 1 ( dimension) to many (fact) relationship between dimesnon and fact, I'm getting less records
EX:
Dimension
ProductID | ProductName |
1 | Cycle |
2 | Car |
Fact
Date | ProductId | Amount |
2021-12-20 | 1 | 2 |
final Result
ProductID | ProductName | Amount |
1 | Cycle | 2 |
2 | bike
|
DAX Code: EVALUATE
SELECTCOLUMNS(
SUMMARIZE(
ProductId,ProductName,"TotalAmount",'Amount')
ProductId,
ProductName,
"TotalAmount","TotalAmount")
Thanks,
Abhiram
Solved! Go to Solution.
Hi @abhiram342 ,
Since you have a 1:* relationship between the Fact table and Dimension table, then to achieve a left outer join, you need to enable the option "Show items with no data" only.
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @abhiram342 ,
Since you have a 1:* relationship between the Fact table and Dimension table, then to achieve a left outer join, you need to enable the option "Show items with no data" only.
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Vahid - Sorry , It's typo final result as below. Relationship betwen dimension and table is Star Schema 1 to many
ProductId | ProductName | Amount |
1 | Cycle | 2 |
2 | Car |
Hi @abhiram342
Can you please let us know the relationship between those Fact and dimension tables? which columns and the cardinality?
Then how did you add Bike to the final result table?
Appreciate your Kudos!!
LinkedIn: www.linkedin.com/in/vahid-dm/
Hi @VahidDM - Sorry , It's typo, final result as below. Relationship betwen dimension and table is Star Schema 1 to many
ProductId | ProductName | Amount |
1 | Cycle | 2 |
2 | Car |
Hi @abhiram342
use this code to create a new table:
Table =
ADDCOLUMNS (
'Dimension',
"Amount",
CALCULATE (
SUM ( 'Fact'[Amount] ),
FILTER ( 'Fact', 'Fact'[ProductId] = EARLIER ( 'Dimension'[ProductID] ) )
)
)
Output:
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: www.linkedin.com/in/vahid-dm/
User | Count |
---|---|
47 | |
27 | |
23 | |
18 | |
15 |
User | Count |
---|---|
55 | |
34 | |
18 | |
17 | |
15 |