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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
rkgundabhat
Helper I
Helper I

Percent Measure

Hello,

I am working with a table with columns Item, _and sales. Somes of the items has 0 sales. I need a measure which I use to show in a data card which shows the percent of items with 0 sales for a department. I can use Department as visual filter if needed and sort the data for a deparment first and then add measure on the top. Is this the right approach. 

Appreciate any guidance. 

 

Thank you 

 

 

1 ACCEPTED SOLUTION

Hi, @rkgundabhat 

 

You can try the following methods.

Measure = 
Var _N1=CALCULATE(COUNT('Table'[Item]),FILTER(ALLEXCEPT('Table','Table'[Department]),[Sales]=0))+0
Var _N2=CALCULATE(COUNT('Table'[Item]),ALLEXCEPT('Table','Table'[Department]))+0
Return
DIVIDE(_N1,_N2)

vzhangti_0-1703665909487.pngvzhangti_1-1703665921117.png

Is this the result you expect? Please see the attached document.

 

Best Regards,

Community Support Team _Charlotte

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

 

View solution in original post

6 REPLIES 6
v-zhangti
Community Support
Community Support

Hi, @rkgundabhat 

 

Can you provide sample data for testing? Sensitive information can be removed in advance. What kind of expected results do you expect? You can also show it with pictures or Excel. I look forward to your response.

 

Best Regards,

Community Support Team _Charlotte

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

@v-zhangti 

I apologize for the delay. Here is a sample data. Items are unique. What I want to do is to find out for any given department  what is percentage of items with 0 sales

Department ItemSales
Dept1P14
Dept1P25
Dept2P30
Dept2P44
Dept3P55
Dept3P60
Dept4P40

Hi, @rkgundabhat 

 

You can try the following methods.

Measure = 
Var _N1=CALCULATE(COUNT('Table'[Item]),FILTER(ALLEXCEPT('Table','Table'[Department]),[Sales]=0))+0
Var _N2=CALCULATE(COUNT('Table'[Item]),ALLEXCEPT('Table','Table'[Department]))+0
Return
DIVIDE(_N1,_N2)

vzhangti_0-1703665909487.pngvzhangti_1-1703665921117.png

Is this the result you expect? Please see the attached document.

 

Best Regards,

Community Support Team _Charlotte

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

 

Hi,

Try these measures

S = sum(Data[sales])

S with 0 value = countrows(filter(values(Data[Item]),[s]=0))

All items = countrows(Data)

Create a slicer of Department and select one department.  Drag this measure to a card visual

P = divide([S with 0 value],[All items])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @rkgundabhat 

Would something like this help?

Pct of Items with No Sales = 
VAR _TotalItems = DISTINCTCOUNT( 'Sales'[Item] )
VAR _ItemsWithNoSales =
    COUNTROWS(
        FILTER(
            SUMMARIZE(
                'Sales',
                [Item],
                "_Sales",
                    SUM( 'Sales'[Sales] )
            ),
            [_Sales] < .00001
        )
    )
VAR _Pct =
    DIVIDE(
        _ItemsWithNoSales,
        _TotalItems
    )
RETURN
    _Pct

Let me know if you have any questions.

 

Percent Inactive Products.pbix

 



Proud to be a Super User!

daxformatter.com makes life EASIER!
gmsamborn
Super User
Super User

Hi @rkgundabhat 

 

Would something like this help?

Pct Inactive = 
VAR _AllProducts =
    CALCULATE(
        COUNTROWS( 'Product' ),
        ALL( 'Product'[ProductKey] )
    )
VAR _ActiveProducts =
    CALCULATE(
        DISTINCTCOUNT( 'Sales'[ProductKey] )
    )
VAR _InactiveProducts = _AllProducts - _ActiveProducts
VAR _Pct =
    DIVIDE(
        _InactiveProducts,
        _AllProducts
    )
RETURN
    _Pct

Let me know if you have any questions.



Proud to be a Super User!

daxformatter.com makes life EASIER!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.