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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Isiluzun
Frequent Visitor

How to Calculate the expression with text and number format filters?

Hello All,

 

I had a trouble with below measure.

 

Tons 2017 for A= calculate(SUM('Data dump'[Tons]), 'Data dump'[Year]=2017, 'Data dump'[Company]=A )

 

Year filter 2017 is in the number format while the company filter is in text format. I read that it is not possible to have mathematical calculation with a text filter so tried some other formulas to reach the desired measure but couldnt succeed. Any suggestions?

 

Many thanks in advance!

1 ACCEPTED SOLUTION
Stachu
Community Champion
Community Champion

the error only shows up if you want to apply text filter to numeric column or the reverse
assuming 'Data dump'[Year] is numeric and 'Data Dump'[Company is text this should work:

Tons 2017 for A= CALCULATE(SUM('Data dump'[Tons]), 'Data dump'[Year]=2017, 'Data dump'[Company]="A" )

if 'Data dump'[Year] is also text then this should work

Tons 2017 for A= CALCULATE(SUM('Data dump'[Tons]), 'Data dump'[Year]="2017", 'Data dump'[Company]="A" )

 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

View solution in original post

2 REPLIES 2
Stachu
Community Champion
Community Champion

the error only shows up if you want to apply text filter to numeric column or the reverse
assuming 'Data dump'[Year] is numeric and 'Data Dump'[Company is text this should work:

Tons 2017 for A= CALCULATE(SUM('Data dump'[Tons]), 'Data dump'[Year]=2017, 'Data dump'[Company]="A" )

if 'Data dump'[Year] is also text then this should work

Tons 2017 for A= CALCULATE(SUM('Data dump'[Tons]), 'Data dump'[Year]="2017", 'Data dump'[Company]="A" )

 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Thank you very much, it works now!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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