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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
AshuKumar011
New Member

Multiple Slicer based Output

i have legal Entity column which i can use it as multiple select slice i have to create one count rows card in which i have to show count the no person belong to that particular slicer selection either one value is selected or multiple . now i have to create one mod that gives me the value that is divided by 4 now need one measure that dive the value if mod is 0 then  count /4 and result should be q1 = count /4 ,q2 = count /4 ,q2= count /4 ,q3 = count /4, q4 = count /4, if mod 1 result should be q1 = (count /4)+1 ,q2 = count /4 ,q2= count /4 ,q3 = count /4, q4 = count /4, if mod 2 result should be q1 = (count /4) ,q2 = count /4 ,q2= (count /4)+1 ,q3 = count /4, q4 = count /4, if mod 3 result should be q1 = (count /4)+1 ,q2 = (count /4)+1 ,q2= (count /4)+1 ,q3 = count /4, q4 = count /4, i need to show the table format  Quartile and count of genders. as per the above calculations

1 ACCEPTED SOLUTION
Sahir_Maharaj
Super User
Super User

Hello @AshuKumar011,

 

Can you please try this approach:

 

1. Create a measure to count the number of persons

PersonCount = 
CALCULATE(
    COUNTROWS('YourTableName'),
    ALLSELECTED('YourTableName'[Legal Entity])
)

2. Create Measures for Each Quartile

PersonCountDiv4 = DIVIDE([PersonCount], 4, 0)

Modulus = MOD([PersonCount], 4)

Quartile1 = 
SWITCH(
    TRUE(),
    [Modulus] = 0, [PersonCountDiv4],
    [Modulus] = 1, [PersonCountDiv4] + 1,
    [Modulus] = 2, [PersonCountDiv4],
    [Modulus] = 3, [PersonCountDiv4] + 1,
    0
)

Quartile2 = 
SWITCH(
    TRUE(),
    [Modulus] = 0, [PersonCountDiv4],
    [Modulus] = 1, [PersonCountDiv4],
    [Modulus] = 2, [PersonCountDiv4],
    [Modulus] = 3, [PersonCountDiv4] + 1,
    0
)

Quartile3 = 
SWITCH(
    TRUE(),
    [Modulus] = 0, [PersonCountDiv4],
    [Modulus] = 1, [PersonCountDiv4],
    [Modulus] = 2, [PersonCountDiv4] + 1,
    [Modulus] = 3, [PersonCountDiv4] + 1,
    0
)

Quartile4 = 
SWITCH(
    TRUE(),
    [Modulus] = 0, [PersonCountDiv4],
    [Modulus] = 1, [PersonCountDiv4],
    [Modulus] = 2, [PersonCountDiv4],
    [Modulus] = 3, [PersonCountDiv4],
    0
)

3. Create a Table and display the Results

Quartiles = DATATABLE(
    "Quartile", STRING,
    { {"Q1"}, {"Q2"}, {"Q3"}, {"Q4"} }
)
QuartileCount = 
SWITCH(
    TRUE(),
    SELECTEDVALUE(Quartiles[Quartile]) = "Q1", [Quartile1],
    SELECTEDVALUE(Quartiles[Quartile]) = "Q2", [Quartile2],
    SELECTEDVALUE(Quartiles[Quartile]) = "Q3", [Quartile3],
    SELECTEDVALUE(Quartiles[Quartile]) = "Q4", [Quartile4],
    0
)

Hope this helps.


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ About: https://sahirmaharaj.com/about.html
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

View solution in original post

2 REPLIES 2
AshuKumar011
New Member

But when applyig filters of genders it is not giving right numbes1

Sahir_Maharaj
Super User
Super User

Hello @AshuKumar011,

 

Can you please try this approach:

 

1. Create a measure to count the number of persons

PersonCount = 
CALCULATE(
    COUNTROWS('YourTableName'),
    ALLSELECTED('YourTableName'[Legal Entity])
)

2. Create Measures for Each Quartile

PersonCountDiv4 = DIVIDE([PersonCount], 4, 0)

Modulus = MOD([PersonCount], 4)

Quartile1 = 
SWITCH(
    TRUE(),
    [Modulus] = 0, [PersonCountDiv4],
    [Modulus] = 1, [PersonCountDiv4] + 1,
    [Modulus] = 2, [PersonCountDiv4],
    [Modulus] = 3, [PersonCountDiv4] + 1,
    0
)

Quartile2 = 
SWITCH(
    TRUE(),
    [Modulus] = 0, [PersonCountDiv4],
    [Modulus] = 1, [PersonCountDiv4],
    [Modulus] = 2, [PersonCountDiv4],
    [Modulus] = 3, [PersonCountDiv4] + 1,
    0
)

Quartile3 = 
SWITCH(
    TRUE(),
    [Modulus] = 0, [PersonCountDiv4],
    [Modulus] = 1, [PersonCountDiv4],
    [Modulus] = 2, [PersonCountDiv4] + 1,
    [Modulus] = 3, [PersonCountDiv4] + 1,
    0
)

Quartile4 = 
SWITCH(
    TRUE(),
    [Modulus] = 0, [PersonCountDiv4],
    [Modulus] = 1, [PersonCountDiv4],
    [Modulus] = 2, [PersonCountDiv4],
    [Modulus] = 3, [PersonCountDiv4],
    0
)

3. Create a Table and display the Results

Quartiles = DATATABLE(
    "Quartile", STRING,
    { {"Q1"}, {"Q2"}, {"Q3"}, {"Q4"} }
)
QuartileCount = 
SWITCH(
    TRUE(),
    SELECTEDVALUE(Quartiles[Quartile]) = "Q1", [Quartile1],
    SELECTEDVALUE(Quartiles[Quartile]) = "Q2", [Quartile2],
    SELECTEDVALUE(Quartiles[Quartile]) = "Q3", [Quartile3],
    SELECTEDVALUE(Quartiles[Quartile]) = "Q4", [Quartile4],
    0
)

Hope this helps.


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ About: https://sahirmaharaj.com/about.html
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors