I'm trying to build a calculation that takes their values from a Parameter. The paramater is feeded from a string dimension.
Using SuperStore as an example, I've created a Parameter called Country Par
containing all the Country/Region
values.
For example, let's assume I have as a page filter Country/Region
= France
and the value for the Country Par
= United Kingdom
. Also, Month(Order Date)
for Columns and Measure Values
for Rows.
The measure values selected will be:
SUM(Sales)
SUM(Comparable Country Sales)
What I'm trying to achieve with the calculation is to retrive the values selected from the Parameter - in this case United Kingdom - ignoring whatever is selected as page filter. (France in the example).
And the same time I want to filter the Sales for United Kingdom ending the same month as Finland.
But due to the FIXED context, seems like LOD is not able to pickup the last month of Finland - Oct 2019.
Comparable Country Sales
{fixed MONTH([Order Date]):
sum(
if [Country/Region]=[Country Par]
and month([Order Date]) <= {max(if [Country/Region]="Finland" then month([Order Date]) end)}
then [Sales]
else null
END)}
This is only a representation of what I want to achieve in my original datasets, for obvious reasons I can't share the data.
A few suggestions here-
I have proceeded like this..
( Note: In superstore data, I have played around on State field instead on Country as in latest version only US data is available)
desired calculated field
with calculation as
{fixed DATETRUNC('month', [Order Date]):
sum(
if [State]= [Par1]
and ([Order Date]) <= {max(if [State] = [Par2] then ([Order Date]) end)}
then [Sales]
else null
END)}
See this works in my case
Good Luck
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.