Forum Discussion

PreetiSahu321's avatar
6 years ago
Solved

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:

 

 

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

  • Anonymous's avatar
    Anonymous
    6 years ago
    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")

6 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    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])

     

    • PreetiSahu321's avatar
      PreetiSahu321
      Helper I

      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?

      • Greg_Deckler's avatar
        Greg_Deckler
        Community Champion

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