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
PreetiSahu321
Helper I
Helper I

Filter Text using DAX

Hello Power BI Community Members,

 

I have a requirement where I can use only the Power BI DAX. In Power BI Desktop, I have a table named as Marksheet. This table has below columns as:

  1. Title (By default)
  2. Subject (Choice data type)
  3. Marks (Number data type)

As per my requirement, I have to filter only the Title column using Measure. You can see the below screenshot:

 

12.png

 

As the above screenshot, I want to filter the title column using Measure formula (Not by using Slicer Filter, For your understanding purpose, I have taken Slicer filter). As my requirement, I want to view the mark sheet of each person. Let me clear you.

 

Here, I want to only view the mark sheet of Preeti and after that, in the Clustered Bar Chart, it will show me all the marks of Preeti only.

As I am new to Power BI DAX, I don't have much knowledge about this. Can anyone suggest to me what I have to do in this case?

Also, You can see my sample report by clicking below link:

Marksheet Report

1 ACCEPTED SOLUTION
Anonymous
Not applicable

KevinProjectedMTDSales = CALCULATE(SUM('Report for Sales'[Projected MTD Sales_]),'Report for Sales'[Title]="KEVIN")

KevinCurrentMonthBudget = CALCULATE(SUM('Report for Sales'[Current Month Budget]),'Report for Sales'[Title]="KEVIN")

View solution in original post

6 REPLIES 6
Greg_Deckler
Super User
Super User

Per your requirement to do it in DAX, you should probably do something along the lines of:

 

Measure = 
VAR __table = FILTER('Table',[Title] = "Preeti")
RETURN
SUMX(__table,[Marks])

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi @Greg_Deckler ,

 

Thanks for your reply!!

 

And one more thing I want to know is If I will take a text column (Basically String) instead of [Marks], then What should I use the function instead of SUMX?

 

Because when I am trying to enter a text column instead of marks, it is showing me an error as:

"The Function SUMX can not work with values of type String".

Please, can you suggest me what I have to do?

If you are returning a string, you would want to use something like MAXX or MINX instead of SUMX.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi @Greg_Deckler ,

 

I have another table named Report for Sales where I have to do the same requirement as the Marksheet table. In this Report for Sales table, I have to filter each person's details from the Title column. You can see the below screenshot.

 

12.png

Here, In this above screenshot, I have taken a slicer filter for your understanding purpose. As per my requirement, I want to show each person details. For example, When I will select "KEVIN", it will display only the details of KEVIN only.

But I want to do this thing by using Measure not by using any Filter.

 

Also, I have used your Measure formula as you said, but it is not working for me. And one more thing I want to say is, I want to display the measure by using the Clustered bar chart like the above screenshot.

You can view my sample report by clicking this link: Sample Report

Please, Can you suggest me what I have to do?

Anonymous
Not applicable

KevinProjectedMTDSales = CALCULATE(SUM('Report for Sales'[Projected MTD Sales_]),'Report for Sales'[Title]="KEVIN")

KevinCurrentMonthBudget = CALCULATE(SUM('Report for Sales'[Current Month Budget]),'Report for Sales'[Title]="KEVIN")

how would you do multiple words? IE Kevin, Jerry, Anisha

 

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