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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
sinanalmac
Resolver I
Resolver I

Filter to count the calculation using slicer from another table

Hi   all,
I need to  preapare a report  about Availability. I 'm trying to Calculate count  product no  by  availability= 'yes ' / calculate  count  productcode   by availability all
I aplied this

CountYes = CALCULATE(count('Table'[ProductCode]),'Table'[Availability]="Yes")/CALCULATE(Count('Table'[ProductCode])) 

 when I filtered with this mesause is doesn't work preperly.
then I aplied this :

CountYes = CALCULATE(count('Table'[ProductCode]),'Table'[Availability]="Yes")/CALCULATE(count('Table'[ProductCode]),ALLEXCEPT('Table','Table'[Date].[Year],'Table'[Group],'Table'[Point type],'Table'[Region],'Table'[Week]))

After this Measure, I could filter   "Allexcept column" " data in the same table
but   I can't filter from  anatoher dimesion  table .
Is there any one  that knows  How can I do that
here is my power BI link  it  maybe help

https://www.dropbox.com/s/ccwcw6xmdwqdpky/Count.pbix?dl=0

here is my  realtionship

filter.jpg

 best regards
sinan
 

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

Hi @sinanalmac ,

The relationship of your tables in the data model is right, but you have create wrong column and measure:

I have created a measure like this:

Measure = 
VAR x = 
CALCULATE(
    COUNT('Table'[ProductCode]),
    FILTER(
        'Table',
        'Table'[Availability] = "yes"
    )
)
VAR y = 
CALCULATE(
    COUNT('Table'[ProductCode]),
    ALLSELECTED(Week[WeekOrder])
)
RETURN
x/y

I don’t know that what does your ‘WeekOrder’ column want to calculate.
Is this what you want?

WeekOrder = 
RANKX (
        FILTER(
            Week,
            Week[Week Year] = EARLIER(Week[Week Year])
        ),
        Week[WeekNumber],
        ,
        ASC,
        DENSE
)

e12.PNG

 

Best regards,
Lionel Chen

 

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
v-lionel-msft
Community Support
Community Support

Hi @sinanalmac ,

The relationship of your tables in the data model is right, but you have create wrong column and measure:

I have created a measure like this:

Measure = 
VAR x = 
CALCULATE(
    COUNT('Table'[ProductCode]),
    FILTER(
        'Table',
        'Table'[Availability] = "yes"
    )
)
VAR y = 
CALCULATE(
    COUNT('Table'[ProductCode]),
    ALLSELECTED(Week[WeekOrder])
)
RETURN
x/y

I don’t know that what does your ‘WeekOrder’ column want to calculate.
Is this what you want?

WeekOrder = 
RANKX (
        FILTER(
            Week,
            Week[Week Year] = EARLIER(Week[Week Year])
        ),
        Week[WeekNumber],
        ,
        ASC,
        DENSE
)

e12.PNG

 

Best regards,
Lionel Chen

 

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

hi  @v-lionel-msft  thank for your solution and your interested. 


Your  solution Turn on a light in my mind

Thank you for helping me?

I 've also  found  anather solution  regarding this.   I just  want to share  it
KEEPFILTERS AND REMOVEFILTERS functions are also  working.

CountYes = CALCULATE(count('Table'[ProductCode]),'Table'[Availability]="Yes")/CALCULATE(Count('Table'[ProductCode]),KEEPFILTERS(table[date].[Year]) 

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.