Forum Discussion
filtering a column based on length of string
- 3 years ago
hi rohit_singh here is the sample. in the filter you can see that ther are 13 blank and 7083 empty. when i cross checked this in postgresql i saw that powerbi shows the percent for empty cells when using blank() and not the percent for null values.
but there is a solution for this that i got with following dax:
NB Cities fields = (CALCULATE(COUNTROWS(individuals),FILTER(individuals,individuals[ind_city] = blank()))/((CALCULATE(COUNTROWS(individuals)))))using COUNTROWS i got both blank and empty values. earlier i was not using countrowsThanks for your help in this rohit_singh
Hi rdvasisht ,
Please try chaning the measure to this :
Input
Output
Kind regards,
Rohit
Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos!
- rdvasisht3 years agoFrequent Visitor
hi rohit_singh thanks for looking into this. for some reasons i have null values (1000) and empty values(6000) so if i use blank in DAX then it gives me percent of blank values and ignores the 6000 cells ( not sure why). that is why i needed to use len in the measure. or may be is there a workaround for this. i tried to use isempty() which ddi not work.
- rohit_singh3 years ago
Solution Sage
Hi rdvasisht ,
Could you share a sample of your data? Especially the null and empty values if possible,
Kind regards,
Rohit- rdvasisht3 years agoFrequent Visitor
hi rohit_singh here is the sample. in the filter you can see that ther are 13 blank and 7083 empty. when i cross checked this in postgresql i saw that powerbi shows the percent for empty cells when using blank() and not the percent for null values.
but there is a solution for this that i got with following dax:
NB Cities fields = (CALCULATE(COUNTROWS(individuals),FILTER(individuals,individuals[ind_city] = blank()))/((CALCULATE(COUNTROWS(individuals)))))using COUNTROWS i got both blank and empty values. earlier i was not using countrowsThanks for your help in this rohit_singh