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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
jiexika24
Frequent Visitor

DAX Measure to Show % GT

Hello, I'm seeking edits to my DAX measure.

 

I have a pie chart showing whether participants prefer trainings (1) In-Person, (2) Online, (3) Hybrid, or (4) No Preference. In PowerQuery, I unpivoted the column ensuring to keep all rows, so the values could be blank, 1, 2, 3, or 4. I want to ignore the blanks and calculate the % of the GT for each.

 

However, when I built the pie chart, it's not showing the true data, which is (1) In-person with 1 count = 7.69%, (2) Online with 9 counts = 69.23%, (3) Hybrid with 1 count = 7.69%, and (4) No Preference with 2 counts 14.38% = 100%.

 

Below is the DAX measure that is returning wrong data. Please see image for the output.

 

Online/In-Person % of GT =
VAR NonBlankRowCount =
    CALCULATE(
        COUNTROWS('Table Name'),
        FILTER(
            'Table Name',
            NOT(ISBLANK('Table Name'[Online/In-Person Unpivoted Value]))
        )
    )
VAR DistinctValueCount = DISTINCTCOUNT('Table Name'[Online/In-Person Unpivoted Value])
RETURN
    DIVIDE(DistinctValueCount, NonBlankRowCount, 0) * 100
 
pie chart.png
 
Thanks for any suggestions!
1 REPLY 1
v-jianpeng-msft
Community Support
Community Support

Hi, @jiexika24 

Can you provide some sample PBIX files? Based on your description, it's hard to model what your table will look like. Please be careful not to include private data.

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors