Forum Discussion
DAX - Column content based on slicer selection
- 8 years ago
Hi Anonymous,
Did you had a measure or a calculated column?
I'm assuming that since your data is always the same in the sample you showned that you created a calculated column, this will give you the maximum value of the date column in your data.
Below you can see the same measure as you have but in a calculated colum (COLUMN_REF) and in a measure (MEASURE_REF) the only one that changes accordingly to the slicer is the measure.
You need to change your formula to a measure instead of the column.
Regards,
MFelix
I will test this as soon as I’m back at work tomorrow :) to answer your question, I would like to reference the value in REFERENCE DATE in several formulas and have a result dependant upon the filter.
Do you think that this solution will enable this?
Thanks,
OF
Hi Anonymous,
If you reference to this measure on the other formulas this will give you the expected result.
But be aware that using a measure is based on context so some of the formulas are not just simply using the measure you need to use aggregators or some filters in the new measures.
Regards,
MFelix
- Anonymous8 years agoNot applicable
Hi MFelix,
First off, thank you for responding and helping me.
I followed your instruction to the letter but unfortunately the filter fails to display the correct value and more importantly, the calculated measure returns a date that doesn't exist in any of the fields.
Unfortunately I am not able to share the PBI file due to sensitive data but let me know if there is anything I can provide that could help with troubleshooting.
Thanks,
OZ
- MFelix8 years ago
Super User
Hi Anonymous,
Can you share the measure you created?
Regards,
MFelix- Anonymous8 years agoNot applicable
Here it is:
DATE_REFERENCE_CREATION =
SWITCH(
TRUE(),
MAX('Slicer Table'[CREATION DATE])="REQUISITION",MAX('Receipts & Overdues'[CREATION_DATE_REQ]),
MAX('Slicer Table'[CREATION DATE])="PURCHASE ORDER", MAX('Receipts & Overdues'[CREATION_DATE_PO]),
MAX ('Receipts & Overdues'[CREATION_DATE_REQ])
)