Forum Discussion

dofrancis3's avatar
dofrancis3
Resolver I
2 years ago
Solved

Create age pyramid

Dear Colleagues

 

Please i would like to request you support to fund a solution regardig the question below: 

How can I create an age pyramid like this in Power bi

 

Thank you for your support.

 

fd.

 

  • Hi,

    Here is an example:
    Data:

    Calculated column:

    Age Bracket =
    var _age = [Age] RETURN
    SWITCH(TRUE(),
    _age<10,"0-9",
    _age<20,"10-20",
    _age<30,"20-30")

     

    Dax measures:

    Female count =
    SUMX('Table (38)',IF([Gender]="M",BLANK(),-1))

    Male count =

    SUMX('Table (38)',IF([Gender]="F",BLANK(),1))
    End result:




    This is the base logic, you can add more categories by using different measures. Here I am simply adding male and female counts.


    I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

    My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/

1 Reply

  • ValtteriN's avatar
    ValtteriN
    Community Champion

    Hi,

    Here is an example:
    Data:

    Calculated column:

    Age Bracket =
    var _age = [Age] RETURN
    SWITCH(TRUE(),
    _age<10,"0-9",
    _age<20,"10-20",
    _age<30,"20-30")

     

    Dax measures:

    Female count =
    SUMX('Table (38)',IF([Gender]="M",BLANK(),-1))

    Male count =

    SUMX('Table (38)',IF([Gender]="F",BLANK(),1))
    End result:




    This is the base logic, you can add more categories by using different measures. Here I am simply adding male and female counts.


    I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

    My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/