Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I have a client data base, i first calculate the total amount of people that are in my dataset.
Numero de clientes = COUNTROWS('Clientes')
after that, i proceed to calculate the amount of men and women that are in my dataset using CALCULATE
Hombres = var hombres = CALCULATE( [Numero de clientes], 'Clientes'[Sexo] = "Masculino")) return if(isblank(hombres), 0, hombres)
Mujeres = var mujeres = CALCULATE([Numero de clientes], 'Clientes'[Sexo] = "Femenino")) return if(isblank(mujeres), 0, mujeres)
Next i want to know the %
% Hombres = [Hombres] / [Numero de clientes]
% Mujeres = [Mujeres] / [Numero de clientes]
This is the result:
Then i try to filter using a slicer, i should get 0 in "Mujeres" when i select for example to show only info related to "hombres", instead i'm getting this:
How can i resolve this? If i selected "Masculino" i should get Hombres: 21 100% hombres and 0 Mujeres 0% Mujeres.
Thanks for the help!
Solved! Go to Solution.
Try these for [Hombres] and [Mujeres]:
Hombres =
var hombres = CALCULATE( [Numero de clientes],FILTER('Clientes, 'Clientes'[Sexo] = "Masculino"))
return if(isblank(hombres), 0, hombres)
Mujeres =
var mujeres = CALCULATE([Numero de clientes],FILTER('Clientes', 'Clientes'[Sexo] = "Femenino"))
return if(isblank(mujeres), 0, mujeres)
Proud to be a Super User!
Paul on Linkedin.
Hi, @camilocorralesg
You can try the following methods.
Numero de clientes = COUNTROWS('Clientes')Hombres =
IF (
SELECTEDVALUE ( Clientes[Sexo] ) = "Masculino",
CALCULATE ( [Numero de clientes], 'Clientes'[Sexo] = "Masculino" ),
IF (
SELECTEDVALUE ( Clientes[Sexo] ) = BLANK (),
CALCULATE ( [Numero de clientes], 'Clientes'[Sexo] = "Masculino" ),
0
)
)Mujeres =
IF (
SELECTEDVALUE ( Clientes[Sexo] ) = "Femenino",
CALCULATE ( [Numero de clientes], 'Clientes'[Sexo] = "Femenino" ),
IF (
SELECTEDVALUE ( Clientes[Sexo] ) = BLANK (),
CALCULATE ( [Numero de clientes], 'Clientes'[Sexo] = "Femenino" ),
0
)
)
The rest of the equations remain unchanged.
Does this meet your expected results?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @camilocorralesg
You can try the following methods.
Numero de clientes = COUNTROWS('Clientes')Hombres =
IF (
SELECTEDVALUE ( Clientes[Sexo] ) = "Masculino",
CALCULATE ( [Numero de clientes], 'Clientes'[Sexo] = "Masculino" ),
IF (
SELECTEDVALUE ( Clientes[Sexo] ) = BLANK (),
CALCULATE ( [Numero de clientes], 'Clientes'[Sexo] = "Masculino" ),
0
)
)Mujeres =
IF (
SELECTEDVALUE ( Clientes[Sexo] ) = "Femenino",
CALCULATE ( [Numero de clientes], 'Clientes'[Sexo] = "Femenino" ),
IF (
SELECTEDVALUE ( Clientes[Sexo] ) = BLANK (),
CALCULATE ( [Numero de clientes], 'Clientes'[Sexo] = "Femenino" ),
0
)
)
The rest of the equations remain unchanged.
Does this meet your expected results?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hombres =
CALCULATE(
[Numero de clientes],
KEEPFILTERS( 'Clientes'[Sexo] = "Masculino" )
) + 0Mujeres =
CALCULATE(
[Numero de clientes],
KEEPFILTERS( 'Clientes'[Sexo] = "Femenino" )
) + 0
| Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
Try these for [Hombres] and [Mujeres]:
Hombres =
var hombres = CALCULATE( [Numero de clientes],FILTER('Clientes, 'Clientes'[Sexo] = "Masculino"))
return if(isblank(hombres), 0, hombres)
Mujeres =
var mujeres = CALCULATE([Numero de clientes],FILTER('Clientes', 'Clientes'[Sexo] = "Femenino"))
return if(isblank(mujeres), 0, mujeres)
Proud to be a Super User!
Paul on Linkedin.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!