- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Calculate percentage based on other column
Dear Team;
Please i'm requesting your support regarding the DAX mesure.
I would like to calculate the percentage (lethality rate):
1. According to to the Gender
2. According to The gender and the region
Thank you
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I would declare variables and use the calculate and countrows functions. I'm not sure what your table names are but I imagine your dax should look something like this:
COUNTROWS('TableName'[GENDER]),
)
COUNTROWS('TableName'[GENDER]),
'TableName'[Death]="1",
)
I put that IF() statement in the return of a lot of my measures that I use in cards because I hate it when the answer is 0% and the card shows "(BLANK)."
You can use similar expressions for the other percentages you want to find.
Remember if you click on your measure, then modeling, you can modify the result to return a percentage and how many decimal places you want to show.
One final caveat, the calculate() function tends to wreak havoc if you want to use this measure for a drill through.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear @SGroff ,
Thank you so much for your support.
But if i have the tables (1srt one OR second one) below how can i calculate the percentage? (Dax)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think you're asking me if you can calculate mortality percentages for different populations, for example, females between the ages of 5 and 14. Calculate() allows you to filter by more than one field. See above where I filtered the countrows() expression by gender and mortality. Simply seperate the different arguments by a comma.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I would declare variables and use the calculate and countrows functions. I'm not sure what your table names are but I imagine your dax should look something like this:
COUNTROWS('TableName'[GENDER]),
)
COUNTROWS('TableName'[GENDER]),
'TableName'[Death]="1",
)
I put that IF() statement in the return of a lot of my measures that I use in cards because I hate it when the answer is 0% and the card shows "(BLANK)."
You can use similar expressions for the other percentages you want to find.
Remember if you click on your measure, then modeling, you can modify the result to return a percentage and how many decimal places you want to show.
One final caveat, the calculate() function tends to wreak havoc if you want to use this measure for a drill through.

Helpful resources
Subject | Author | Posted | |
---|---|---|---|
05-08-2024 01:23 AM | |||
07-30-2024 01:07 PM | |||
02-12-2024 08:18 AM | |||
11-22-2023 06:04 AM | |||
10-20-2023 10:27 AM |
User | Count |
---|---|
23 | |
12 | |
10 | |
10 | |
9 |
User | Count |
---|---|
16 | |
15 | |
15 | |
13 | |
11 |