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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Calculated column which counts totals with several filters

I've have a custom table and need to calculate some count totals on it. 

 

I'm trying to count the total amount of "yes" per date, per ID number (see example). The ID number is not unique and trying to find how many times a certain ID number has "yes" on every day. Is there a way to have a calculated column (or maybe custom table) that totals the amount of a certain word and can filter on other data?

 

Count total (calculated column)           Adjustment           Date                        ID number
2                                                           No                          29-3-2021 00:00     1
5                                                           Yes                          29-3-2021 00:00     2
3                                                           No                          29-3-2021 00:00     2
4                                                           Yes                         29-3-2021 00:00      4
3                                                           No                          30-3-2021 00:00      2

1 ACCEPTED SOLUTION
Dhacd
Resolver III
Resolver III

Hi @Anonymous 

Here is another solution for the problem that you are facing.

 

Dhacd_1-1657640200780.png

Create a calculated column by using the below dax code and use that column as a sum.

Count = 
Var _Id='Table'[ID number]
Var _Date='Table'[Date]
Var _FiltTable = Filter('Table','Table'[ID number] = _Id&& _Date ='Table'[Date]&& 'Table'[Adjustment]= "Yes")

Return  Calculate(COUNT('Table'[ID number]),_FiltTable)


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

View solution in original post

3 REPLIES 3
Dhacd
Resolver III
Resolver III

Hi @Anonymous 

Here is another solution for the problem that you are facing.

 

Dhacd_1-1657640200780.png

Create a calculated column by using the below dax code and use that column as a sum.

Count = 
Var _Id='Table'[ID number]
Var _Date='Table'[Date]
Var _FiltTable = Filter('Table','Table'[ID number] = _Id&& _Date ='Table'[Date]&& 'Table'[Adjustment]= "Yes")

Return  Calculate(COUNT('Table'[ID number]),_FiltTable)


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

Anonymous
Not applicable

This worked, thank you very much

jcalheir
Solution Supplier
Solution Supplier

Hi

 

Create a measure and use it in the report.

You can create a table visual in the report with the fields: Date, ID number and Measure; and i guess you get the expected results

 

 

 

Measure = 
COUNTROWS(
    GROUPBY(YOUR_TABLE,YOUR_TABLE[Date],YOUR_TABLE[ID number])
)

 

 

Kind regards,
José
Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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