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
RhoFox
Frequent Visitor

Count row with same values in two columns

Hi There

I need help with some column "count"

 

ProjectDateTextCount

P1

01.01.2021text11
P101.01.2021text22
P101.01.2021text33
P102.01.2021text41
P201.01.2021text51
P201.01.2021text62
P102.01.2021text72
P102.01.2021text83
P102.01.2021text94


I need to count number of rows when: Project is the same and Date is the same
i know it's not difficult, but unfortunately i can't find the right formula 😕

 

I am very grateful for every answer

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi, @RhoFox 

Please check the below for creating a new column.

 

Picture1.png

 

Count CC =
VAR currentproject = 'Table'[Project]
VAR currentdate = 'Table'[Date]
RETURN
RANKX (
FILTER (
'Table',
'Table'[Project] = currentproject
&& 'Table'[Date] = currentdate
),
'Table'[Text],
,
ASC
)

 

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

5 REPLIES 5
Jihwan_Kim
Super User
Super User

Hi, @RhoFox 

Please check the below for creating a new column.

 

Picture1.png

 

Count CC =
VAR currentproject = 'Table'[Project]
VAR currentdate = 'Table'[Date]
RETURN
RANKX (
FILTER (
'Table',
'Table'[Project] = currentproject
&& 'Table'[Date] = currentdate
),
'Table'[Text],
,
ASC
)

 

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


ooooh it works 😄
thank you a lot
I just saw that I still have a problem, I have another column with true / false values, it should only count if the column = true

Hi, @RhoFox 

Thanks for your feedback.

Please share your sample pbix file's link here, then I can try to look into it.

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


vanessafvg
Super User
Super User

you can do a

 

summarizetable =
SUMMARIZE ( table[Project], table[Date], "RowCount", COUNTROWS ( table ) )

 

 





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




selimovd
Super User
Super User

Hey @RhoFox ,

 

you can do that with a CALCULATE and then you can tell which column should be considered for the count with the ALLEXCEPT function:

Count Measure =
CALCULATE(
    COUNTROWS( myTable ),
    ALLEXCEPT(
        myTable,
        myTable[Project],
        myTable[Date]
    )
)

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

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.