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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Calculate % of reports disposed for each category based on quantity of another column from model

I have 3 columns in my data model:
* Location (string)
* Disposition Category/Time Frame (string)
* Quanity of reports (numeric)

I am trying to calculate the percentage of reports that are disposed within each time frame for each location. I have the number of reports for each category for each location (see attached matrix), but I am having trouble writing the Dax expression to calculate the disposition percentage because I need to omit specific disposition categories, and I am using the numeric value from a different column. The formula I am trying to replicate is below. Thank you! CA example.jpg

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thank you, @Icey

 

Yes, that is what my table looks like. I tried the both of the measures you sent, and I am not getting the same percentages. I have attached the below screenshot to show my updated matrix. Any help is greatly appreciated. Thank you!! 

 

Marie 

 

CA example2.jpg

View solution in original post

4 REPLIES 4
Icey
Community Support
Community Support

Hi @Anonymous ,

Is this your table like?

calculate.PNG

If so, you can create your measures like so:

percent A =
IF (
    CALCULATE (
        SUM ( 'Table'[Quanity of reports] ),
        'Table'[Disposition Category/Time Frame] <> "Pending From 155 to 301 days"
    ) > 9,
    DIVIDE (
        CALCULATE (
            SUM ( 'Table'[Quanity of reports] ),
            'Table'[Disposition Category/Time Frame] = "Dispoesd Afer 301 days"
        ),
        CALCULATE (
            SUM ( 'Table'[Quanity of reports] ),
            'Table'[Disposition Category/Time Frame] <> "Pending From 155 to 301 days"
        )
    )
)

Or,

Measure =
IF (
    CALCULATE (
        SUM ( 'Table'[Quanity of reports] ),
        'Table'[Disposition Category/Time Frame] <> "Pending From 155 to 301 days"
    ) > 9,
    DIVIDE (
        SUMX (
            FILTER (
                'Table',
                'Table'[Disposition Category/Time Frame] <> "Pending From 155 to 301 days"
            ),
            'Table'[Quanity of reports]
        ),
        CALCULATE (
            SUM ( 'Table'[Quanity of reports] ),
            'Table'[Disposition Category/Time Frame] <> "Pending From 155 to 301 days"
        )
    )
)

calculate2.PNG

 

If I have any misunderstandings, please let me know.

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Thank you, @Icey

 

Yes, that is what my table looks like. I tried the both of the measures you sent, and I am not getting the same percentages. I have attached the below screenshot to show my updated matrix. Any help is greatly appreciated. Thank you!! 

 

Marie 

 

CA example2.jpg

Icey
Community Support
Community Support

Hi @Anonymous ,

 

This is my PBIX file.

 

Best Regards,

Icey

Anonymous
Not applicable

Thank you so much!! I got it to work! 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.