Forum Discussion
Measure with multiple dates
- 6 years ago
Not sure if this is what you mean, but you can get a card of those values with this one measure. Note that there are carriage returns in the "return" part.
Four Dates = var thisday = TODAY()var yesterday = thisday -1var thisweek = thisday - WEEKDAY(thisday) +1 & " - " & thisday-WEEKDAY(thisday) + 7var lastweek = thisday-6-WEEKDAY(thisday) & " - " & thisday-WEEKDAY(thisday)return"Today - " & thisday & "Yesterday - " & yesterday & "This Week - " & thisweek & "Last Week - " & lastweekI tried to add a pic of the card visual but pics aren't showing in my posts at the moment.If this works for you, please mark it as the solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
- Anonymous6 years ago
Hi Anonymous,
You can't use the measure to return multiple results, it is a calculated expression based on row contents. (if you did not has any category fields, it can only one result value)
If you want this measure to return four type of calculation results, you need to create a category with these category types(Yesterday, Today, last week, and This week) and add switch function into the measure formula with different categories.
Then you can navigate to different calculation expressions based on current category value.
Measure =
VAR currCate =
SELECTEDVALUE ( Table[Category] )
RETURN
SWITCH (
currCate,
"Yesterday", 'formula1',
"Today", 'formula2',
"last week", 'formula3',
"This week", 'formula4'
)
Regards,
Xiaoxin Sheng
Anonymous
Thanks for your response. A coule of questions though,
1) When you say categories, do you mean the actual dates for each(Today, yesterday, last week and this week)?
2) So, this is not a question but more of a correction based on my question. There is no date field so I will be using Current day as my date field, possibly Today() formula.
3) Lastly,do i need to create formula1, 2,3 and 4 too?