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

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

Reply
Anonymous
Not applicable

Count regardless of Row Context

Hi,

I have a simple table with count of opportunities by created date and closed date. 

I want to create a table that shows the same number of opportunity that were created on that month regardless of when they closed. (The row should have the same number each column). So for example, in the right table, the row 2014 May should all have 376 each column, June 2014 should have 229 each column.

Right now I am using this formula: 

Denominator = CALCULATE(COUNTROWS(Opp),ALLSELECTED(Opp[CloseDate])).
 

 

Capture.JPG

1 ACCEPTED SOLUTION

Sorry, I'd flipped my created and closed dates around as I assumed the data could not be correct the other way around...

 

So if it is CreateDate on the rows that is the column you'd want to bring back in using VALUES()

 

eg.

 

Denominator = CALCULATE(COUNTROWS(Opp),ALL(Opp),VALUES(Opp[CreateDate].[Date]))

View solution in original post

6 REPLIES 6
d_gosbell
Super User
Super User

I'm assuming that in your screenshot that the columns across the page are created dates, and the rows are closed dates (based on the assumption that the columns start in 2013 and the rows start in 2014 and you can't close items before they are created).

 

So shouldn't your formula be the following:

 

Denominator = CALCULATE(COUNTROWS(Opp),ALLSELECTED(Opp[CreatedDate])).

 

Or have I misunderstood what values are on rows and columns in your matrix visual?

Anonymous
Not applicable

Thanks @d_gosbell for the reply. I have closedate in columns and created date in rows so it's the opposite. 

So you are saying that the circled item below was created in May 2014, but closed over a year earlier in Jan 2013? That seems a bit strange.

2019-03 closed vs created.png

 

I think the problem with this is that ALLSELECTED retains the row and column filter context so you probably want to use a calculation like the following using ALL to strip out all the filters then using VALUES to just bring back the CloseDate filters

Denominator = CALCULATE(COUNTROWS(Opp),ALL(Opp),VALUES(Opp[CloseDate]))
Anonymous
Not applicable

Haha yeah we have some serious data integrity issues. 

I tried the solution but it didn't work...

Capture.JPG

Sorry, I'd flipped my created and closed dates around as I assumed the data could not be correct the other way around...

 

So if it is CreateDate on the rows that is the column you'd want to bring back in using VALUES()

 

eg.

 

Denominator = CALCULATE(COUNTROWS(Opp),ALL(Opp),VALUES(Opp[CreateDate].[Date]))
Anonymous
Not applicable

Thank you! It worked!

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

Top Solution Authors
Top Kudoed Authors