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
Anonymous
Not applicable

How to use something similar to CALCULATE with a string Column

Hi,

 

I need to do a filter very similar to this:

 

XXX = 

CALCULATE(
 SUM('All Activity '[NAME]),
 FILTER('All Activity ','All Activity '[TASK] = "Design Check"))

... but the column which I need to filter ('All Activity '[NAME]) is a column that contains STRINGS, same as the value that I need to obtain, so I can't use CALCULATE, or SUM but I'm completely ignorant of which options could I use.

I tried changing SUM by ALL, but I got an error that explains that I'm getting multiple values where there is only one value expected.
 
If someone can help me, would make my day 🙂
1 ACCEPTED SOLUTION

Hi @Anonymous 

 

You can add a new column to your table with this DAX:

New Column = 
if('Table'[TASK]="Design Check",'Table'[NAME],blank())

 

Output:

VahidDM_0-1642635344876.png

 

 

or if you need Measure, use this:

Measure = 
if(max('Table'[TASK])="Design Check",max('Table'[NAME]),BLANK())

 

output:

VahidDM_1-1642635440037.png

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @VahidDM ,

 

First of all thanks for your reply. I'll do my best to explain my issues.

 

I have a Table with many columns, two of them that I need to work with are text Columns as in the example table 

 

NAMETASKDATEEtc... 
MariaDesign Check1/12/22Etc... 
JhonDesign1/12/22Etc... 
JhonDrafting7/12/22Etc... 
MelissaDesign13/12/22Etc... 
MelanieDesign Check13/12/22Etc... 

 

I need a filter that, for example, return the name in Table[NAME] if Table[TASK] = "Design Check". 

 

I've tried with some DAX like this, but without success:

IF([Task Name]) = "Design Check", [Engineer Name], BLANK())
 
[Task Name] and [Engineer Name] are metrics because for some reason the IF doesn't allow me to use the Table[Column] reference straight foward. I made them like this:
 
Engineer Name = ALL('Table'[NAME])
 
Usually, if I need to do this type of filter I'ld use the DAX that I used as an example in the first post, but since the column that I need to pull the info from is TEXT that filter does not work.
 
THANKS in advance.

Hi @Anonymous 

 

You can add a new column to your table with this DAX:

New Column = 
if('Table'[TASK]="Design Check",'Table'[NAME],blank())

 

Output:

VahidDM_0-1642635344876.png

 

 

or if you need Measure, use this:

Measure = 
if(max('Table'[TASK])="Design Check",max('Table'[NAME]),BLANK())

 

output:

VahidDM_1-1642635440037.png

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

Anonymous
Not applicable

Thanks @VahidDM , you made my day!!! 😉

VahidDM
Super User
Super User

Hi @Anonymous 

 

Can you post sample data as text and expected output?
Not enough information to go on;

please see this post regarding How to Get Your Question Answered Quickly:
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.
4. Relation between your tables

Appreciate your Kudos!!
LinkedIn:www.linkedin.com/in/vahid-dm/

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.

Top Solution Authors