Forum Discussion
If with selectedvalue
- 5 years ago
Hi, Anonymous
According to your description, I think you can use 'isfiltered' function in measure.
Like this:
Contribution Margin = VAR Mth1 = SELECTEDVALUE ( SelMth_Current[Month] ) VAR yr = SELECTEDVALUE ( SelYr[Year] ) VAR Fcst1 = SELECTEDVALUE ( SelMth4[Actual] ) VAR Prod = SELECTEDVALUE ( Product_Grp[Product] ) VAR Reg = SELECTEDVALUE ( Region_Grp[Region] ) VAR MthVal1 = CALCULATE ( SUM ( Profitability_Consolidation[Profit] ), Profitability_Consolidation[Period] = Fcst1, Profitability_Consolidation[Month] = Mth1, Profitability_Consolidation[Year] = yr, Profitability_Consolidation[Product] = Prod, Profitability_Consolidation[AccountGroup] = "Contribution Margin" ) VAR MthVal2 = CALCULATE ( SUM ( Profitability_Consolidation[Profit] ), Profitability_Consolidation[Period] = Fcst1, Profitability_Consolidation[Month] = Mth1, Profitability_Consolidation[Year] = yr, Profitability_Consolidation[Product] = Prod, Profitability_Consolidation[Region] = Reg, Profitability_Consolidation[AccountGroup] = "Contribution Margin" ) RETURN IF ( ISFILTERED ( 'table'[Region] ), MthVal2 / 1000, MthVal1 / 1000 )If it doesn’t solve your problem, please feel free to ask me.
Best Regards
Janey Guo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, Anonymous
According to your description, I think you can use 'isfiltered' function in measure.
Like this:
Contribution Margin =
VAR Mth1 =
SELECTEDVALUE ( SelMth_Current[Month] )
VAR yr =
SELECTEDVALUE ( SelYr[Year] )
VAR Fcst1 =
SELECTEDVALUE ( SelMth4[Actual] )
VAR Prod =
SELECTEDVALUE ( Product_Grp[Product] )
VAR Reg =
SELECTEDVALUE ( Region_Grp[Region] )
VAR MthVal1 =
CALCULATE (
SUM ( Profitability_Consolidation[Profit] ),
Profitability_Consolidation[Period] = Fcst1,
Profitability_Consolidation[Month] = Mth1,
Profitability_Consolidation[Year] = yr,
Profitability_Consolidation[Product] = Prod,
Profitability_Consolidation[AccountGroup] = "Contribution Margin"
)
VAR MthVal2 =
CALCULATE (
SUM ( Profitability_Consolidation[Profit] ),
Profitability_Consolidation[Period] = Fcst1,
Profitability_Consolidation[Month] = Mth1,
Profitability_Consolidation[Year] = yr,
Profitability_Consolidation[Product] = Prod,
Profitability_Consolidation[Region] = Reg,
Profitability_Consolidation[AccountGroup] = "Contribution Margin"
)
RETURN
IF ( ISFILTERED ( 'table'[Region] ), MthVal2 / 1000, MthVal1 / 1000 )If it doesn’t solve your problem, please feel free to ask me.
Best Regards
Janey Guo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous5 years agoNot applicable
Many thanks much appreciated for the excellent response 👍
- Anonymous5 years agoNot applicable
Hi can you kindly assist with https://community.powerbi.com/t5/Desktop/Unable-to-Use-New-Reporting-Header-Column-in-Table-Visual/m-p/1678473#M669086
- v-janeyg-msft5 years agoCommunity Support
Hi, Anonymous
Due to the nature of the work, other colleagues are responsible for this case. I believe he will reply to you soon.
Best Regards
Janey Guo