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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
juhoneyighot
Helper III
Helper III

DAX Count Formula for a Specified Row

Hello!

 

I need help with the correct Count DAX formula ont this.I have this table (Time entry) I need to have the following:

 

1 Time-Off TYpe Column: This is a conditional formula if the Type is Vacation, Status is Approve and if Description is Sick Leave then Time-Off Type is Sick Leave else is Casual.

juhoneyighot_1-1710853971362.png

 

2. I have to get the count the number of rows with Casual and number of rows with Sick Leave.

 

Thank you,

 

Juhoney

2 ACCEPTED SOLUTIONS
JamesFR06
Resolver IV
Resolver IV

Hello

 

To get the total for casual and SL, open a matrice put the column To Type in it and the measur I gave you. it will give you the total

View solution in original post

v-yaningy-msft
Community Support
Community Support

Hi, @juhoneyighot 

Pls have you solved this problem now? you can refer to @JamesFR06 reply, thanks for your positive reply. If it doesn't solve the problem, you can refer to my method below.

vyaningymsft_0-1712050707980.pngvyaningymsft_1-1712050788181.png

 

Time Off Type = 
IF(
    'Table'[Description] = BLANK()
    ||'Table'[Type] = BLANK()
    ||'Table'[Status] = BLANK(),
    BLANK(),
    IF(
        'Table'[Type] = "Vacation"
            && 'Table'[Description] = "Sick Leave"
            && 'Table'[Status] = "Approve",
        "Sick Leave",
        "Casual"
    )
)

 

count of Casual = 
CALCULATE (
    COUNTROWS ( 'Table' ),
    FILTER ( 'Table', 'Table'[Time Off Type] = "Casual" )
)

count of Sick Leave = 
CALCULATE (
    COUNTROWS ( 'Table' ),
    FILTER ( 'Table', 'Table'[Time Off Type] = "Sick Leave" )
)

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

6 REPLIES 6
v-yaningy-msft
Community Support
Community Support

Hi, @juhoneyighot 

Pls have you solved this problem now? you can refer to @JamesFR06 reply, thanks for your positive reply. If it doesn't solve the problem, you can refer to my method below.

vyaningymsft_0-1712050707980.pngvyaningymsft_1-1712050788181.png

 

Time Off Type = 
IF(
    'Table'[Description] = BLANK()
    ||'Table'[Type] = BLANK()
    ||'Table'[Status] = BLANK(),
    BLANK(),
    IF(
        'Table'[Type] = "Vacation"
            && 'Table'[Description] = "Sick Leave"
            && 'Table'[Status] = "Approve",
        "Sick Leave",
        "Casual"
    )
)

 

count of Casual = 
CALCULATE (
    COUNTROWS ( 'Table' ),
    FILTER ( 'Table', 'Table'[Time Off Type] = "Casual" )
)

count of Sick Leave = 
CALCULATE (
    COUNTROWS ( 'Table' ),
    FILTER ( 'Table', 'Table'[Time Off Type] = "Sick Leave" )
)

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

JamesFR06
Resolver IV
Resolver IV

Hello

 

To get the total for casual and SL, open a matrice put the column To Type in it and the measur I gave you. it will give you the total

Oh I'm sorry.

 

My apology, Only thos Vaction with approved status will have an Sick Leave and Casual in time Off Type

juhoneyighot_0-1710867423256.png

I hope you will help me ont his. My biggest apology.

 

Thank you,

 

Juhoney

 

TO Type = IF(AND(msdyn_timeentry[Type]="Vacation", and(msdyn_timeentry[Entry Status]="Approve", msdyn_timeentry[Description]="Sick Leave")),"Sick Leave",

IF(AND(msdyn_timeentry[Type]="Vacation", and(msdyn_timeentry[Entry Status]="Approve","Casual"))

JamesFR06
Resolver IV
Resolver IV

Hi

 

If(and([type]="Vacation",and([Status]="Approve,[Description]="Sick Leave")),"Sick Leave", "Casual)

 

to get the count =countrows(filter([Table],[Time Off Type]="Sick Leave")

Hello!

Ive tried the formula but it wont filter

juhoneyighot_0-1710863922956.png

here is the formula that ive entered:

TO Type = IF(AND(msdyn_timeentry[Type]="Vacation", and(msdyn_timeentry[Entry Status]="Approve", msdyn_timeentry[Description]="Sick Leave")),"Sick Leave","Casual")

 

juhoney

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.