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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Count with multiple conditions

Hi, 

 

I have this calculation below but the syntax appears to be incorrect. Any idea how to make this work please?

 

Jobs =
CALCULATE(COUNT(mort[mort_no]), 
(mort[mort_id] = 12), 
(mort[mort_desc] = "Open"), 
(mort[mort_type] = "NEW"), 
YEAR(mort[Date_In])>2017)
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Try this:

 

Jobs =
CALCULATE (
    COUNT ( mort[mort_no] ),
    (
        mort[mort_id] = 12
        && mort[mort_desc] = "Open" 
        && mort[mort_type] = "NEW"
        && YEAR ( mort[Date_In] ) > 2017
    )
)

View solution in original post

3 REPLIES 3
v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous ,

I created some data:

vyangliumsft_0-1634887838631.png

Here are the steps you can follow:

1. Create measure.

Measure =
COUNTX(FILTER(ALL('Table'),'Table'[mort_id]=12&&'Table'[mort_desc]="Open"&&'Table'[mort_type]="New"&&'Table'[Date_IN]>2017),[mort_no])

2. Result:

vyangliumsft_1-1634887838632.png

 

Best Regards,

Liu Yang

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

Anonymous
Not applicable

Try this:

 

Jobs =
CALCULATE (
    COUNT ( mort[mort_no] ),
    (
        mort[mort_id] = 12
        && mort[mort_desc] = "Open" 
        && mort[mort_type] = "NEW"
        && YEAR ( mort[Date_In] ) > 2017
    )
)
smpa01
Super User
Super User

@Anonymous  try this

 

Measure =
CALCULATE (
    COUNT ( mort[mort_no] ),
    FILTER (
        SUMMARIZE (
            mort,
            mort[mort_id],
            mort[mort_desc],
            mort[mort_type],
            mort[Date_In]
        ),
        mort[mort_id] = 12
            && mort[mort_desc] = "Open"
            && mort[mort_type] = "NEW"
            && YEAR ( mort[Date_In] ) > 2017
    )
)
Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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