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,
I am trying to trplicate a formula in Tableau like, ([Plan $] + IIF([Version]=[Version Toggle],[Perf $],0))
[Version] is a column in a table
[Version Toggle] is a dynamic value where the user can toggle between two values.
In PoweBI , I will use selected value to get the value selected by user.
Since Power BI measure returns only one value, I could not use formula like below,
sum([Plan $]) + If ( values([table.version]) = selectedvalue([Version Toggle]), sum([Perf $]) , 0)
Sample values:
Version = 000, 001, 003, 004
Version Toggle values , 000, 001
So, how do I achieve it?
Thanks in advance.
Solved! Go to Solution.
Try something like this
Measure =
VAR _toggleValue =
CALCULATE (
SELECTEDVALUE ( 'Table1'[Toggle values] )
)
VAR _version =
CALCULATE (
SELECTEDVALUE ( 'Table'[version] )
)
VAR _add =
IF (
_togglevalue = _version,
SUM ( 'Table'[Perf $] ),
0
)
VAR _sum =
SUM ( 'Table'[Plan $] ) + _add
RETURN
_sum
Can you provide sample data and expected output.
Did I answer your question? Mark my post as a solution!
Appreciate with a kudos 🙂
Hi @simuruge
you might consider creating pbix file that will contain some sample data (remove the confidential info), upload the pbix to onedrive for business and share the link to the file. Please do not forget to describe the expected results based on this sample data.
@simuruge , there are few good examples for that, refer of them can fit in your case
https://powerpivotpro.com/2013/03/hasonevalue-vs-isfiltered-vs-hasonefilter/
https://www.kasperonbi.com/use-isinscope-to-get-the-right-hierarchy-level-in-dax/
Try something like this
Measure =
VAR _toggleValue =
CALCULATE (
SELECTEDVALUE ( 'Table1'[Toggle values] )
)
VAR _version =
CALCULATE (
SELECTEDVALUE ( 'Table'[version] )
)
VAR _add =
IF (
_togglevalue = _version,
SUM ( 'Table'[Perf $] ),
0
)
VAR _sum =
SUM ( 'Table'[Plan $] ) + _add
RETURN
_sum
Can you provide sample data and expected output.
Did I answer your question? Mark my post as a solution!
Appreciate with a kudos 🙂
Hi Nandu,
Thanks for your answer.
I tried the below logic but it was not working. I have simplifed the output to give me either 1 or 0 based on condition.
Regards,
Sid
Test this
test =
VAR _toggleValue =
CALCULATE (
SELECTEDVALUE ( table[Toggle values] )
)
VAR _version =
CALCULATE (
SELECTEDVALUE ( [Version] )
)
VAR output =
IF (
_toggleValue = _version,
1,
0
)
RETURN
output
Did I answer your question? Mark my post as a solution!
Appreciate with a kudos 🙂
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 |
---|---|
112 | |
100 | |
77 | |
74 | |
49 |
User | Count |
---|---|
146 | |
108 | |
106 | |
90 | |
62 |