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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Harinihemanth06
Microsoft Employee
Microsoft Employee

How to remove names from column based on condition

Class IDQuestion Question orderAliasAvg Sat
2Pre1Hari5
2post 2prem4
2Pre3Suj5
2post 4Har5
2Pre5Kal3
2post 6KAl4
2Pre7Chen5
2post 8Chen4
2Pre1Santosh3
2post 2Santosh2
2Pre3Riti5
2post 4Riti5

I have above table i want Dax querey which returns avg Sat if the Alias has answered both pre and post question.

Note that Questions are in pair 1 indicates pre and 2 indicates post applied to all other till 8.

 

Ne

1 ACCEPTED SOLUTION

Hi @Harinihemanth06 ,

We could create formulas to get the data that contains both pre and post. It is not supported to remove values with DAX. There are two ways as workarounds that you can reference.

 

Firstly, create a column in the table.

Column = 
var d = CALCULATE(DISTINCTCOUNT('Table'[Question ]),ALLEXCEPT('Table','Table'[Alias]))
return 
IF(d>1, "True", BLANK())

1.PNG

  • Create a measure to implement.
Measure = CALCULATE(MAX('Table'[Alias]),FILTER('Table','Table'[Column] = "True"))

2.PNG 

  • Create a new table to implement
Table 2 =
SELECTCOLUMNS (
    FILTER ( 'Table', 'Table'[Column] = "True" ),
    "Class ID", 'Table'[Class ID],
    "Question", 'Table'[Question ],
    "Question Order", 'Table'[Question order],
    "Alias", 'Table'[Alias],
    "Avg sat", 'Table'[Avg Sat]
)

3.PNG

Best Regards,

Xue Ding

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Harinihemanth06
Microsoft Employee
Microsoft Employee

Sorry for not being clear about my question.

Let me explain

We have multiple Class ID and multiple Attendents to the class so When ever an individual is attending a class we are tracking

review by  pre and post questions.

Here Question order indicates 1,3,5,7 as pre survey questions and 2,4,6,8 as post survey questions.

Avg Sat Value is valied if only individual answers both the questions. so my requirement is to remove Participents details who have not answered questions in pairs that is pre and post.

 

 

Hi @Harinihemanth06 ,

We could create formulas to get the data that contains both pre and post. It is not supported to remove values with DAX. There are two ways as workarounds that you can reference.

 

Firstly, create a column in the table.

Column = 
var d = CALCULATE(DISTINCTCOUNT('Table'[Question ]),ALLEXCEPT('Table','Table'[Alias]))
return 
IF(d>1, "True", BLANK())

1.PNG

  • Create a measure to implement.
Measure = CALCULATE(MAX('Table'[Alias]),FILTER('Table','Table'[Column] = "True"))

2.PNG 

  • Create a new table to implement
Table 2 =
SELECTCOLUMNS (
    FILTER ( 'Table', 'Table'[Column] = "True" ),
    "Class ID", 'Table'[Class ID],
    "Question", 'Table'[Question ],
    "Question Order", 'Table'[Question order],
    "Alias", 'Table'[Alias],
    "Avg sat", 'Table'[Avg Sat]
)

3.PNG

Best Regards,

Xue Ding

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-xuding-msft Thankyou So much for the Solution.It perfectly servers the puropse. 

@v-xuding-msft There is a minor error if Alias has given rating to all the questions except question 2  i.e 1,2 are pre and post and example :Lars(alias) has given rating for question 1 , question 3 and question 4.

 

Now according to provided input 

Column = 
var d = CALCULATE(DISTINCTCOUNT('Table'[Question ]),ALLEXCEPT('Table','Table'[Alias]))
return 
IF(d>1, "True", BLANK())

Above will return blank if d>1, But now Lars( Alias) has 3 count it is not getting filtered. 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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