Forum Discussion
Slice Facts based on UI events
Calculated columns are populated once, at the time of data refresh. You want to take the exact same code and make it into a Measure, which are not set at data refresh and change dynamically.
Hope this helps
David
- Anonymous7 years agoNot applicable
Hey David:
I did exactly as you suggested. I deleted the column in the data model and attempted to add it as a measure on the FactInternetSales table by cut/pasting the code.
That is giving me an error: A single value for column 'ShipDate' in table 'FactInternetSales' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.
I do not wnat to aggrigate anything. What I'm after is more like a case statement then an aggrigate. Is there a way I can refer to current row??
Thank you for the help.
- dedelman_clng7 years ago
Community Champion
You can apply MIN or MAX to the dates in the formula code without worry as the context for "Current row" will be created by the visual and the measure will be dynamically calculated.
- Anonymous7 years agoNot applicable
OK. I've done that. The formula for the measure is:
FocusDate = if(
selectedvalue(DateFocus[ID]) = 1,
min(FactInternetSales[OrderDate]),
if (
selectedvalue(DateFocus[ID]) = 2,
min(FactInternetSales[DueDate]),
min(FactInternetSales[ShipDate])
)
)the aggrigation error went away. Indeed the measure was added to the table with no error.
Now - when I took the calculated column off of the datamodel, the graphic errored because a data field on the axis was then invalid. My column chart now has only one column - the value being all time. When I drag a real date (say Due Date) to axis, the visual breaks into multiple columns as I expect and want. I remove the real date from Axis, and it goes back to one coilumn - again as I expect. I drag the Focus Date measure to Axis and - nothing. No error message. It just does not drop. The boarder of the axis does turn yellow telling me it expects me to drop. But when I release the mouse button - it goes back to Add data field here.
How can I put a measure on the axis of a visual?