Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hi,
I have a database like this:
| field1 | field2 | field3 | 
| 0,4 | F | 2018 | 
| 0,5 | F | 2019 | 
| 0,6 | G | 2020 | 
where field2 has a text format, field 1 is a number and field3 is like a date but is in text format.
I should make a formula like this one
Measure = IF([mea1]= "labels" OR [mea1]= "chairs", OR [mea1]= "tables",
CALCULATE (
MAX(field1),
field2="F",
field3= MAX(field3)
),
CALCULATE (
MAX(field1)*100 & "%",
field2="F",
field3= MAX(field3)
)
)
I have error at the beginning with the using of or and I have another error  after calculate that says that I can't compare value of type number with value of type text, how should I do to remove these errors?
Thank you
Solved! Go to Solution.
Hi @Giada_Togliatti ,
Would you please refer to the dax below:
Measure =
IF (
    [mea1] = "labels"
        || [mea1] = "chairs"
        || [mea1] = "tables",
    CALCULATE (
        MAX ( field1 ),
        FILTER ( table, field2 = "F" && field3 IN VALUES ( field3 ) )
    ),
    CALCULATE (
        MAX ( field1 ) * 100 & "%",
        FILTER ( table, field2 = "F" && field3 IN VALUES ( field3 ) )
    )
)
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
Hi @Giada_Togliatti ,
Would you please refer to the dax below:
Measure =
IF (
    [mea1] = "labels"
        || [mea1] = "chairs"
        || [mea1] = "tables",
    CALCULATE (
        MAX ( field1 ),
        FILTER ( table, field2 = "F" && field3 IN VALUES ( field3 ) )
    ),
    CALCULATE (
        MAX ( field1 ) * 100 & "%",
        FILTER ( table, field2 = "F" && field3 IN VALUES ( field3 ) )
    )
)
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
@v-deddai1-msft thank you for the formula, but it doesn't work, there is always the problem with the max
Hi @Giada_Togliatti ,
I have modified my original reply, please try again.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
Instead of using "MAX(field1)*100 & "%" try use "FORMAT( max('Table'[Column1]),"Percent")"
Proud to be a Super User!
HI @Giada_Togliatti ,
You can't use OR. Replace it with || in the DAX expression as follows:
Measure = IF([mea1]= "labels" || [mea1]= "chairs" || [mea1]= "tables",
CALCULATE (
MAX(field1),
field2="F",
field3= MAX(field3)
),
CALCULATE (
MAX(field1)*100 & "%",
field2="F",
field3= MAX(field3)
)
)
Also, there was an extra comma (,) in the 1st line of your dax.
Thanks,
Pragati
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved. 
If you found this post helpful, please give Kudos  C 
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query. 
www.excelwithallison.com
thank you for reply,
I think the problem for field 3 is that it's a text and I compare with the maximum of a text
Measura prova max = CALCULATE(sum(field2), field3= max(field3))
it gives me error,
which formula can I use to have the right result and to covert the field3 in a number?
field 3 is like a date with text format (201806, 201906...)
What is [mea1]?
Proud to be a Super User!
mea1 it's the maximum of a text field
 
					
				
				
			
		
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
 
            | User | Count | 
|---|---|
| 84 | |
| 49 | |
| 35 | |
| 31 | |
| 30 |