Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hello Everone,
Hope you're all doing great!
In my dashboard I have a card called (Student No.) and a filter of 2 choices (Schools - Admin Building), in excel file (resource) I have a column (whole number) for how many student in each school, for admin building it will be 0 all the time. I tried to put N/A instead, but an error occured because its a number column.
what I want is a dax for whenever I select admin building, the card will show the text (N/A), but when I select schools, it will show me the number in the excel file.
Solved! Go to Solution.
Hi @Anonymous
You can create a measure to judge , if the choice is “Schools” , sum the number of students , if the choice is “Admin Building” , return the text “N/A” .
Original data :
Measure :
Measure =
VAR _Schools=CALCULATE(SUM('Table'[number]),FILTER('Table','Table'[choices]="Schools"))
return IF(SELECTEDVALUE('Table'[choices])="Schools",_Schools,"N/A")
The final result is as shown :
I have attached my pbix file , you can refer to it .
Best Regard
Community Support Team _ Ailsa Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous
You can create a measure to judge , if the choice is “Schools” , sum the number of students , if the choice is “Admin Building” , return the text “N/A” .
Original data :
Measure :
Measure =
VAR _Schools=CALCULATE(SUM('Table'[number]),FILTER('Table','Table'[choices]="Schools"))
return IF(SELECTEDVALUE('Table'[choices])="Schools",_Schools,"N/A")
The final result is as shown :
I have attached my pbix file , you can refer to it .
Best Regard
Community Support Team _ Ailsa Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I try to apply it on my table, it shows a message (the syntax for return is incorrect), dunno where the problem is
Hi,
Since you only want to display either NA or a number you can circumvent the "variant type error" which you might be encountering by using functions like CONVERT, FORMAT or CONCANETATE. E.g.
Proud to be a Super User!
I tried to make new column in power bi with this DAX
Student_No= Convert( Table_name[column_name(StudentName)], String)
for the card it shows 0 no matter what I chose
@Anonymous , You can create a column based on slicer selection.
Number to text can done easily like this
Table_name[column_name(StudentName)] & ""
For number of student you can try like
count(Table_name[column_name(StudentName)] )+0
or
countrows(filter(Table_name, Table_name[Building]<> "Admin"), Table_name[column_name(StudentName)]) +0
Thaaank you ValtteriN, but
I think I will face a problem using it, if I convert the column to String, then it won't be able to sum students No. for schools, right ?
It will show numbers as a text, but what I want is, whenever I select School it will sum the number of stuedents, and when I select Admin Building ( by default it will sum the 0), number of students will be always 0 so once it reads 0 it will reflect a text (N/A) on the card
do I made it clear ?
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 9 | |
| 5 | |
| 4 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 23 | |
| 12 | |
| 11 | |
| 9 | |
| 8 |