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.
Hi @simuruge
I create a simple sample. Please try the formulas to check if it is what you want.
Measure =
VAR Selected_Version =
SELECTEDVALUE ( 'Table 1'[Version] )
VAR a =
SUMX (
'Table',
'Table'[Plan]
+ IF ( 'Table'[Version] = Selected_Version, SUM ( 'Table'[Perf] ), 0 )
)
RETURN
a
Measure 2 =
VAR Selected_Version =
SELECTEDVALUE ( 'Table 1'[Version] )
VAR a =
SUMX (
'Table',
'Table'[Plan]
+ IF ( 'Table'[Version] = Selected_Version, SUM ( 'Table'[Perf] ), 0 )
)
RETURN
IF ( ISFILTERED ( 'Table 1'[Version] ), a, "No Filter" )
For more details, please download my sample to have a try.
Hi @simuruge
I create a simple sample. Please try the formulas to check if it is what you want.
Measure =
VAR Selected_Version =
SELECTEDVALUE ( 'Table 1'[Version] )
VAR a =
SUMX (
'Table',
'Table'[Plan]
+ IF ( 'Table'[Version] = Selected_Version, SUM ( 'Table'[Perf] ), 0 )
)
RETURN
a
Measure 2 =
VAR Selected_Version =
SELECTEDVALUE ( 'Table 1'[Version] )
VAR a =
SUMX (
'Table',
'Table'[Plan]
+ IF ( 'Table'[Version] = Selected_Version, SUM ( 'Table'[Perf] ), 0 )
)
RETURN
IF ( ISFILTERED ( 'Table 1'[Version] ), a, "No Filter" )
For more details, please download my sample to have a try.
Hi, Thank you so much for the solution. Yes it works and what Nandu had mentioned also worked.
I made an error by pasting the formua in a calculated column. However, when I used a measure it worked fine.
Thank you both for extending your help.
Regards,
Sid
Hi @simuruge ,
My formulas are both of measures. I'm glad that they works for you. 😊
Can you please accept the helpful answer as solution? Then we will be able to close the thread. More people who have the same request will benefit here.
@simuruge , refer if this can help
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 |
---|---|
110 | |
96 | |
77 | |
63 | |
55 |
User | Count |
---|---|
143 | |
109 | |
89 | |
84 | |
66 |