Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Solved! Go to Solution.
Hi All,
Firstly bhanu_gautam thank you for your solution!
And @unknown917 , I tried to simplify your code a bit, not so much conditional judgment , to reduce your code redundancy, to see if it can solve your problem!
Max Possible Hits(column) =
VAR _CalcSingle =
SWITCH(
TRUE(),
'Table'[1 stp threshold] <= 19, 13,
'Table'[1 stp threshold] <= 38, 26,
'Table'[1 stp threshold] <= 77, 52,
'Table'[1 stp threshold] <= 129, 104,
'Table'[1 stp threshold] <= 181, 156,
'Table'[1 stp threshold] <= 233, 208,
'Table'[1 stp threshold] <= 285, 260,
'Table'[1 stp threshold] <= 337, 312,
'Table'[1 stp threshold] <= 4569, 364
)
VAR _CalcMulti =
SWITCH(
TRUE(),
'Table'[>1 stp/wk threshold] <= 19, 13,
'Table'[>1 stp/wk threshold] <= 38, 26,
'Table'[>1 stp/wk threshold] <= 77, 52,
'Table'[>1 stp/wk threshold] <= 129, 104,
'Table'[>1 stp/wk threshold] <= 181, 156,
'Table'[>1 stp/wk threshold] <= 233, 208,
'Table'[>1 stp/wk threshold] <= 285, 260,
'Table'[>1 stp/wk threshold] <= 337, 312,
'Table'[>1 stp/wk threshold] <= 4569, 364
)
RETURN
IF(
'Table'[1 stp threshold]< 52,
_CalcSingle,
IF('Table'[>1 stp/wk threshold]<52,
52,
_CalcMulti))
If you have further questions, you can contact me at any time, I will reply to you as soon as I receive your message, I look forward to hearing from you!
Hope it helps!
Best regards,
Community Support Team_ Tom Shen
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
Hi All,
Firstly bhanu_gautam thank you for your solution!
And @unknown917 , I tried to simplify your code a bit, not so much conditional judgment , to reduce your code redundancy, to see if it can solve your problem!
Max Possible Hits(column) =
VAR _CalcSingle =
SWITCH(
TRUE(),
'Table'[1 stp threshold] <= 19, 13,
'Table'[1 stp threshold] <= 38, 26,
'Table'[1 stp threshold] <= 77, 52,
'Table'[1 stp threshold] <= 129, 104,
'Table'[1 stp threshold] <= 181, 156,
'Table'[1 stp threshold] <= 233, 208,
'Table'[1 stp threshold] <= 285, 260,
'Table'[1 stp threshold] <= 337, 312,
'Table'[1 stp threshold] <= 4569, 364
)
VAR _CalcMulti =
SWITCH(
TRUE(),
'Table'[>1 stp/wk threshold] <= 19, 13,
'Table'[>1 stp/wk threshold] <= 38, 26,
'Table'[>1 stp/wk threshold] <= 77, 52,
'Table'[>1 stp/wk threshold] <= 129, 104,
'Table'[>1 stp/wk threshold] <= 181, 156,
'Table'[>1 stp/wk threshold] <= 233, 208,
'Table'[>1 stp/wk threshold] <= 285, 260,
'Table'[>1 stp/wk threshold] <= 337, 312,
'Table'[>1 stp/wk threshold] <= 4569, 364
)
RETURN
IF(
'Table'[1 stp threshold]< 52,
_CalcSingle,
IF('Table'[>1 stp/wk threshold]<52,
52,
_CalcMulti))
If you have further questions, you can contact me at any time, I will reply to you as soon as I receive your message, I look forward to hearing from you!
Hope it helps!
Best regards,
Community Support Team_ Tom Shen
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
makes sense! thank you!!
@unknown917 , Try using
Max Possible Hits =
VAR Thresholds =
{
(0, 19, 13),
(20, 38, 26),
(39, 77, 52),
(78, 129, 104),
(130, 181, 156),
(182, 233, 208),
(234, 285, 260),
(286, 337, 312),
(338, 4569, 364)
}
VAR GetMaxHits =
VAR CurrentThreshold = 'Table'[1 stp threshold]
RETURN
MAXX(
FILTER(
Thresholds,
CurrentThreshold >= [Value1] && CurrentThreshold <= [Value2]
),
[Value3]
)
VAR GetMaxHitsMulti =
VAR CurrentThresholdMulti = 'Table'[>1 stp/wk threshold]
RETURN
MAXX(
FILTER(
Thresholds,
CurrentThresholdMulti >= [Value1] && CurrentThresholdMulti <= [Value2]
),
[Value3]
)
RETURN
IF(
GetMaxHits < 52,
GetMaxHits,
IF(
GetMaxHitsMulti < 52,
52,
GetMaxHitsMulti
)
)
Proud to be a Super User! |
|