Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Sign up nowGet Fabric certified for FREE! Don't miss your chance! Learn more
Hello,
I am building a PBI report that includes some data and DAX coding for a current, working report. I keep getting the error "Cannot convert value " of type Text to type Number" when creating a custom measure, although my code/formatting is the exact same as the report I'm using to build.
I have 2 tables, one named Data and one named Month. The Month table looks like this:
where the "Month" column has data type Date and format 'March 2001'
The measure I am trying to create is in the Data table, with dax formula:
T3M Commission Profit $ =
var startmonth=value(format(edate(SELECTEDVALUE('Month'[Month]),-2),"yyyyMM"))
var endmonth=SELECTEDVALUE('Month'[YYYYMM])
return Calculate(SUM(Data[CommissionProfitDollars]),FILTER(ALL('Data'), 'Data'[YYYYMM]>=startmonth&&'Data'[YYYYMM]<=endmonth),values(Data[CoworkerName]),VALUES(Data[Team]))
The issue I have found is in the statement.
var startmonth=
Does anyone know why I get an error saying the data is type text when it is date?
Hi @Anonymous,
Can you please share a pbix or some dummy data that keep raw data structure with expected results? It should help us clarify your scenario and test to coding formula.
How to Get Your Question Answered Quickly - Microsoft Power BI Community
Regards,
Xiaoxin Sheng
@Anonymous , First If month is not date then edate(SELECTEDVALUE('Month'[Month]),-2) might not work
better you deal with dates
new measure =
var _max = maxx(allselected(Date),Date[Date])
var _min = eomonth(_max, -2) +1
return
calculate( sum(Table[Value]), filter('Date', 'Date'[Date] >=_min && 'Date'[Date] <=_max))
Thanks for the response! Can you clarify what you mean by the term 'Date' i.e.
allselected(Date),Date[Date] ?
Would that be the month column from the Month table I have? Sorry if this is a dumb response-- super new to PBI
@Anonymous have you verified that the 'Data'[YYYYMM] column is a numeric data type?
Yes it is!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 64 | |
| 63 | |
| 49 | |
| 21 | |
| 18 |
| User | Count |
|---|---|
| 121 | |
| 118 | |
| 38 | |
| 36 | |
| 29 |