Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Chava1881
Helper II
Helper II

How to return a word instead of a date in a measure

I have created a measure that compares two dates that have been selected by the report user; however, one of those dates a month is a baseline of a consensus forecast, the others are the daily operational numbers. In order for the users to have handy what they picked I've created the measure below as a "tag" so it displays the dates selected. 

 

VAR Max_Date_of_Selection = CALCULATE(max(Daily[Capture_Date]),ALLSELECTED(Daily))

VAR Min_Date_of_Selection = CALCULATE(min(Daily[Capture_Date]),ALLSELECTED(Daily))

VAR No_of_date = DISTINCTCOUNT(Daily[Capture_Date])

Return

if( No_of_date = 2, Max_Date_of_Selection&" vs "& Min_Date_of_Selection, "Please select two Dates")

 

this gives a Max Date vs Min Date result, but it doesn't say it is a consensus forecast and daily numbers. So I would like to use one column I have for the extract type that calls out whether it is one or the other. So let's say that 7-01-2022 is the consensus and we are comparing it to today's date: 7-14-2022 I would like to know if instead of retrieving the max/min date - when the two dates are selected it - can actually return for max Daily and Min Consensus, so it displays like this: Daily vs Consensus.

 

Any thoughts? 

5 REPLIES 5
v-chenwuz-msft
Community Support
Community Support

Hi @Chava1881 ,

 

I think you need create a new date table which has no relationship with fact table.

vchenwuzmsft_1-1658218830454.png

Then use this measure to do that.

Measure = 
var _date1 = SELECTEDVALUE(Dim_date_new[Date])
var _date2 = SELECTEDVALUE(Dim_date[Date])
return
IF(not( OR( ISBLANK(_date1),ISBLANK(_date2))),_date1&" vs "&_date2,"please select two dates")

Result:

 

vchenwuzmsft_0-1658218815300.png

 

Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

that's what I currently have, I would like to get the data type instead. Not the dates. 
PBIX is here

Chava1881_1-1658254829317.png

 

 

Tag Selected Dates = 
var mx = max(IBP_Daily[Capture_Date])
var mxl = CALCULATE(max(IBP_Daily[Data_Type]),IBP_Daily[Capture_Date]=mx)
var mn = min(IBP_Daily[Capture_Date])
var mnl = CALCULATE(max(IBP_Daily[Data_Type]),IBP_Daily[Capture_Date]=mn)
return if( countrows(filters(IBP_Daily[Capture_Date])) = 2,mxl &" vs "& mnl, "Please select two Dates")
lbendlin
Super User
Super User

Please provide sanitized sample data that fully covers your issue. If you paste the data into a table in your post or use one of the file services it will be easier to assist you. I cannot use screenshots of your source data.

Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Hello,

PBIX is here

 

This is what I need to get: 

Chava1881_0-1658254743912.png

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Top Solution Authors