Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi all,
I have this datamodel:
Now I want to create a measure that gives values from 'Co' or 'Pa' dim, based on what happens in the 2 facts:
Fact 1 has Type column which has Co or Pa in it; if it's Co I want 'Column' from 'Co' dim, if it's 'Pa' I want 'Column' from 'Pa'
Fact 2 doesn't have Type column, but if Dim3ID <> -1 then I want 'Column' from 'Co' dim, otherwise I want 'Column' from 'Pa'
My measure is now:
NeededMeasure =
VAR vFact1 = IF(SELECTEDVALUE('Fact 1'[Type]) = "Pa", MAX('Pa'[Column]), MAX('Co'[Column]))
VAR vFact2 = IF(SELECTEDVALUE('Fact 2'[Dim2ID]) <> "-1", MAX('Pa'[Column]), MAX('Co'[Column]))
RETURN IF(HASONEVALUE('Dim 1'[Name]), COALESCE(vFact1, vFact2) )
But it's not working as expected. I wanted no lines for 4/5 (as there are no values) and for the first lines I expected:
1 -> because of Pa I wanted the Column value of Pa with ID 2: B
2 -> because of Pa I wanted the Column value of Pa with ID 4: D
3 -> because of Co I wanted the Column value of Co with ID 4: J
Examplefile: https://fastupload.io/VwnAuOs3unOfHRP/file
I don't fully understand your data model. Can you give a little more context?
You use HASONEVALUE against the 'Dim 1'[Name]. That is always true. vFact1 always results in something, so COALESCE doesn't bite either.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
81 | |
75 | |
60 | |
37 | |
33 |
User | Count |
---|---|
102 | |
56 | |
52 | |
46 | |
40 |