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.
Hello All ,
I have a scenario ;
Table A:
ID | WEIGHT | Investment Option | value |
1 | 0.2 | Stocks | 1 |
1 | 1.2 | Accounts | 1 |
2 | 2.2 | Stocks | 1 |
2 | 3.2 | Accounts | 1 |
2 | 4.2 | PPF | 0 |
3 | 5.2 | Stocks | 1 |
Table B: Table B consist of Max Weight group by Id.
id | Weight |
1 | 1.2 |
2 | 4.2 |
3 | 5.2 |
If I select options Stocks , Accounts .
SQL 1. : Select Sum(weight) from table B where ID in (select distinct ID from Table A where Value =1 and Investment Option = 'Stocks , Accounts')
***Investment option would be drived from slicer
SQL 2 : Select Sum(Weight) from table B
measure = SQL1 Result / SQL 2 result
How would this measure can be achived through DAX .
Regards ,
Solved! Go to Solution.
Your post is a little confusing, but let me try
load both tables
Join the tables on the ID column
write these measure.
Sql 1 = calculate(sum(tableA[weight],tableA[value]=1)
sql 2 = sum(tableB[weight])
measure = divide([sql 1],[sql 2])
Your post is a little confusing, but let me try
load both tables
Join the tables on the ID column
write these measure.
Sql 1 = calculate(sum(tableA[weight],tableA[value]=1)
sql 2 = sum(tableB[weight])
measure = divide([sql 1],[sql 2])
Hello @MattAllington ,
Thanks that worked with little tweak as below :
As I wanted max , I took the values from table B and rest other are the same .
Sql 1 = calculate(sum(tableB[weight],tableA[value]=1)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
99 | |
83 | |
70 | |
60 |
User | Count |
---|---|
150 | |
115 | |
104 | |
89 | |
65 |