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.
Hi,
As the subject, is where a condition that the value of VAR might be one value or many.
Take example is this measure :
Solved! Go to Solution.
Hey @admin_xlsior ,
please be aware that IF can not return something different than a scalar value, meaning it can not return an object of type table, https://dax.guide/if/
Unfortunately, I do not fully understand what you are trying to achieve.
What I understand is this, depending on IsRegionValid the variable selectedBranch contains different things, but no matter what it is a table, for this reason I would rewrite things a little different.
Let the variable IsRegionValid either be 0 or 1
And the variable NumOfResources like so:
VAR NumofResources =
CALCULATE(
COUNTROWS(Resource)
, FILTER(... , AND(IsRegionValid = 0 , ...)
, FILTER(... , AND(IsRegionValid = 1 , ...)
)
Hopefully this provides you with some ideas, if you need more input, please consider to provide a pbix that contains sample data, upload the pbix to onedrive or dropbox and share the link.
Regards,
Tom
Hey @admin_xlsior ,
please be aware that IF can not return something different than a scalar value, meaning it can not return an object of type table, https://dax.guide/if/
Unfortunately, I do not fully understand what you are trying to achieve.
What I understand is this, depending on IsRegionValid the variable selectedBranch contains different things, but no matter what it is a table, for this reason I would rewrite things a little different.
Let the variable IsRegionValid either be 0 or 1
And the variable NumOfResources like so:
VAR NumofResources =
CALCULATE(
COUNTROWS(Resource)
, FILTER(... , AND(IsRegionValid = 0 , ...)
, FILTER(... , AND(IsRegionValid = 1 , ...)
)
Hopefully this provides you with some ideas, if you need more input, please consider to provide a pbix that contains sample data, upload the pbix to onedrive or dropbox and share the link.
Regards,
Tom
Hi Tom,
Thanks for the information about IF cannot return other than scalar value. With that I just realized what went wrong, actually the CALCULATE(VALUES(....)) is wrong whereby I should use CALCULATETABLE instead. And by that I should have two VAR as well.
Thanks
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 |
---|---|
96 | |
93 | |
82 | |
70 | |
64 |
User | Count |
---|---|
118 | |
106 | |
93 | |
79 | |
72 |