Forum Discussion
Condition to return text value
- 9 years ago
Hi George,
Have a look at Static Segmentation on DAX Patterns:
http://www.daxpatterns.com/static-segmentation/
As long as your times have Data Type Time, you should be able to use this approach.
Owen :)
- 9 years ago
Hi GeorgeAnonymous
Just making sure - you should use the VALUES function (not the VALUE function) in that pattern.
VALUES ( Dayparts[Daypart] ) is used to return a single value from the Dayparts[Daypart] column corresponding to each row of Programmes.
(The VALUE function is used to convert text to numbers).
The Dayparts table should not be related to Programmes for Static Segmentation.
Here is a dummy pbix file illustrating how you could create a Static Segmentation calculated column using the tables in your example.
https://www.dropbox.com/s/ike0q13pxhr3oca/Static%20segmentation%20time.pbix?dl=1
Hi George,
Have a look at Static Segmentation on DAX Patterns:
http://www.daxpatterns.com/static-segmentation/
As long as your times have Data Type Time, you should be able to use this approach.
Owen :)
- Anonymous9 years agoNot applicable
Hi Owen,
Thank you for your response.
I had tried this but the problem I'm facing is that DAX will not allow me to draw the Daypart value from the Dayparts table (when I type in the Programmes Tab
Daypart = Calculate (Value(it doesn't give me the option to pick 'Dayparts'[Daypart], nor does Related work after Value(.
NB I have linked the two tables on Slot Start -> Slot Mid Point.
Any suggestions on how DAX can pick up the column from Dayparts?
Many thanks,
George.
- OwenAuger9 years agoSuper User
Hi GeorgeAnonymous
Just making sure - you should use the VALUES function (not the VALUE function) in that pattern.
VALUES ( Dayparts[Daypart] ) is used to return a single value from the Dayparts[Daypart] column corresponding to each row of Programmes.
(The VALUE function is used to convert text to numbers).
The Dayparts table should not be related to Programmes for Static Segmentation.
Here is a dummy pbix file illustrating how you could create a Static Segmentation calculated column using the tables in your example.
https://www.dropbox.com/s/ike0q13pxhr3oca/Static%20segmentation%20time.pbix?dl=1
- Anonymous9 years agoNot applicable
Thanks a million for all your help! This did the trick.
I also had to fix the time format in the Advanced Editor to "time" rather than "datetime", which caused the two columns not to match.
George.