Forum Discussion
Change a value by a variable in measure
Hi frostys,
Isn't that formula a solution even if it can work? Can you share a dummy file? To be honest, your scenario isn't complicated.
Best Regards,
Dale
Maybe the solution working, but not for me. Could be a different problem. So I can't tell if this is the right formula yet.
- v-jiascu-msft8 years ago
Microsoft Employee
Hi frostys,
Can you share a dummy sample of your data? Please try the demo in the attachment.
Selected time = VAR selected = SELECTEDVALUE ( 'Time slicer'[Time slicer] ) RETURN IF ( ISBLANK ( selected ), 0, selected )Best Regards,
Dale
- v-jiascu-msft8 years ago
Microsoft Employee
Hi frostys,
The root cause is that we can't use a slicer to change the values of a Calculated table. That's why these solutions here can't work in your scenario. The workaround could be like below. Please give it a try.
1. Create a measure, filter out the blank values.
Measure = VAR CustomersPurchasedLast3Months = SELECTCOLUMNS ( FILTER ( 'Data input', EOMONTH ( 'Data input'[Date], [Selected time] ) > TODAY () ), "Customer", [Controlling Customer Name] ) RETURN IF ( MIN ( 'Data input'[Controlling Customer Name] ) IN CustomersPurchasedLast3Months, BLANK (), 1 )2. The other function that count the numbers of customers also needs to be changed.
customerAmount = VAR CustomersPurchasedLast3Months = SELECTCOLUMNS ( FILTER ( 'Data input', EOMONTH ( 'Data input'[Date], [Selected time] ) > TODAY () ), "Customer", [Controlling Customer Name] ) RETURN CALCULATE ( DISTINCTCOUNT ( 'Data input'[Controlling Customer Name] ), NOT 'Data input'[Controlling Customer Name] IN CustomersPurchasedLast3Months, ALL ( 'Data input' ) )Best Regards,
Dale