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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Calculate Percentage using DAX

I have one table which has two columns- Country, Vaccine Dose Completed(values are 1st, 2nd Dose) and I want to create DAX which will show"Fully Vaccinated" by country and "% Fully Vaccinated"

Akshay_Nis_014_0-1645781874175.png

I am tracking vaccination status in one of column called 'vaccination dose completed' having values- 1st dose, 2nd Dose 
Please assist at earliest. I was able to show "Fully vaccinated" column by filtering the column "vaccination dose completed" but not able to create "% fully Vaccinated" country vise

1 ACCEPTED SOLUTION
v-luwang-msft
Community Support
Community Support

Hi @Anonymous ,

Test the below measure:

Fully Vaccinated = CALCULATE(COUNTROWS('Table'),FILTER(ALL('Table'),'Table'[Country]=MAX('Table'[Country])&&'Table'[Vaccine Dose Completed]="2"))

 

by country and "% Fully Vaccinated =  DIVIDE([Fully Vaccinated],CALCULATE(DISTINCTCOUNT('Table'[Country]),ALL('Table')),4)

Base data:

vluwangmsft_0-1646124879485.png

Output result:

vluwangmsft_1-1646124894293.png

Did I answer your question? Mark my post as a solution!If not ,could you pls share your sample data, and exepct output.


Best Regards

Lucien

View solution in original post

2 REPLIES 2
v-luwang-msft
Community Support
Community Support

Hi @Anonymous ,

Test the below measure:

Fully Vaccinated = CALCULATE(COUNTROWS('Table'),FILTER(ALL('Table'),'Table'[Country]=MAX('Table'[Country])&&'Table'[Vaccine Dose Completed]="2"))

 

by country and "% Fully Vaccinated =  DIVIDE([Fully Vaccinated],CALCULATE(DISTINCTCOUNT('Table'[Country]),ALL('Table')),4)

Base data:

vluwangmsft_0-1646124879485.png

Output result:

vluwangmsft_1-1646124894293.png

Did I answer your question? Mark my post as a solution!If not ,could you pls share your sample data, and exepct output.


Best Regards

Lucien

amitchandak
Super User
Super User

@Anonymous , for % fully vaccinated, we need an idea about the population. So do you have that number?

 


Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.