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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
forbi
Frequent Visitor

dax percentage calculation

I have two tables :

 

IDtypedays
1C5
2C10
3N7
4C

15

 

ProductDeadline
A10
B15

 

I want to calculate by a measure :

Divide
count rows where type = C and days <= deadline ,
count rows where type = C

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @forbi ,

Please try below steps:

1. below is my test table 

Table1:

vbinbinyumsft_0-1673851067834.png

Table2:

vbinbinyumsft_1-1673851083047.png

2. create a measure with below dax formula

Measure =
VAR pt =
    SELECTEDVALUE ( Table2[Product] )
VAR dl =
    CALCULATE ( MAX ( Table2[Deadline] ), Table2[Product] = pt )
VAR tmp1 =
    FILTER ( ALL ( Table1 ), Table1[Type] = pt && Table1[Days] <= dl )
VAR tmp2 =
    FILTER ( ALL ( Table1 ), Table1[Type] = pt )
RETURN
    DIVIDE ( COUNTROWS ( tmp1 ), COUNTROWS ( tmp2 ) )

3. add some visual like below

vbinbinyumsft_2-1673851239504.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
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

2 REPLIES 2
Anonymous
Not applicable

Hi @forbi ,

Please try below steps:

1. below is my test table 

Table1:

vbinbinyumsft_0-1673851067834.png

Table2:

vbinbinyumsft_1-1673851083047.png

2. create a measure with below dax formula

Measure =
VAR pt =
    SELECTEDVALUE ( Table2[Product] )
VAR dl =
    CALCULATE ( MAX ( Table2[Deadline] ), Table2[Product] = pt )
VAR tmp1 =
    FILTER ( ALL ( Table1 ), Table1[Type] = pt && Table1[Days] <= dl )
VAR tmp2 =
    FILTER ( ALL ( Table1 ), Table1[Type] = pt )
RETURN
    DIVIDE ( COUNTROWS ( tmp1 ), COUNTROWS ( tmp2 ) )

3. add some visual like below

vbinbinyumsft_2-1673851239504.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@forbi , what is the join column between two table?

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

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.