Forum Discussion
Lily36876
2 years agoHelper II
Use Parameter Values and Group by
Hi Guys, I want to develop a report with setting parameters on filter, and will directly effect on report result But now is fail when I want to group 【CalculateTransactionRange】this columns ...
Anonymous
2 years agoNot applicable
Hi Lily36876 ,
I made simple samples and you can check the results below:
Measure = VAR _t = ADDCOLUMNS('Table',"A",SUMX(FILTER(ALL('Table'),[ShopNo]=EARLIER([ShopNo])),[AMT]))
RETURN SUMX(_t,[A])
Please feel free to correct me and provide more information if I have misunderstood you!
An attachment for your reference. Hope it helps!
Best regards,
Community Support Team_ Scott Chang
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
Lily36876
2 years agoHelper II
Hello!!!
Thanks for reply, I think i missing to give this infomation.
I don't have range column in data model,
because range level is generated on what my parameter setting
and my range logic is below
CalculateTransactionRange =
VAR interval1 ='interval_1'[interval1 值]
VAR interval2='interval_2'[interval2 值]
VAR LOWERLimit='LOWER_Limit'[LOWERLimit 值]
VAR UPPERLimit='UPPER_Limit'[UPPERLimit 值]
VAR HPyTotal=SELECTEDVALUE(SalesRecord[HPyTotal])
VAR RANGE=
SWITCH (
TRUE (),
HPyTotal < LOWERLimit,
SWITCH (
TRUE (),
HPyTotal <= LOWERLimit,
"0 ~ " & LOWERLimit,
TRUE,
INT((HPyTotal - LOWERLimit) / interval1) * interval1 + LOWERLimit + 1 & "~" & INT((HPyTotal - LOWERLimit)) / interval1 * interval1 + LOWERLimit + interval1
),
HPyTotal >= LOWERLimit && HPyTotal <= UPPERLimit,
SWITCH (
TRUE (),
HPyTotal <= LOWERLimit + interval1,
LOWERLimit+1 & "~" & LOWERLimit + interval1,
HPyTotal = UPPERLimit,
UPPERLimit - interval1 + 1 & "~" & UPPERLimit,
TRUE,
INT((HPyTotal - LOWERLimit) / interval1) * interval1 + LOWERLimit + 1 & "~" & INT((HPyTotal - LOWERLimit) / interval1) * interval1 + LOWERLimit + interval1
),
HPyTotal > UPPERLimit+1,
SWITCH (
TRUE (),
HPyTotal <= UPPERLimit + interval2,
UPPERLimit + 1 & "~" & UPPERLimit + interval2,
TRUE,
INT((HPyTotal - UPPERLimit - 1) / interval2) * interval2 + UPPERLimit + 1 & "~" & INT((HPyTotal - UPPERLimit - 1) / interval2) * interval2 + UPPERLimit + interval2
),
"Other"
)
RETURN RANGE