cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
sovereignauto
Helper III
Helper III

Count from summarizecolumns

Good Afternoon,

 

If i create a variable using summarizecolumns like so: 

 

How would i then use this to count the "count" column

 

var _data = SUMMARIZECOLUMNS(
Claims_History[Date].[Date],
filter(Claims_History, related(KAM_STAFF[FullName]) = pending[fullname]),
filter(Claims_History, Claims_History[Date].[Date] >= _Sdate && Claims_History[Date].[Date] <= _Edate),
"count",count(Claims_History[AN]))
 
Thank you 
1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@sovereignauto With the table summarized, counting the count column is the same as counting the rows in the table so you can use COUNTROWS. You could also use COUNTX or any of the other X aggregation functions if you wanted to be specific about the column or wanted an aggregation like sum, SUMX(_data,[count]).


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
Greg_Deckler
Super User
Super User

@sovereignauto With the table summarized, counting the count column is the same as counting the rows in the table so you can use COUNTROWS. You could also use COUNTX or any of the other X aggregation functions if you wanted to be specific about the column or wanted an aggregation like sum, SUMX(_data,[count]).


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler Do you know why i would be getting the error: 

 
"SummarizeColumns() and AddMissingItems() may not be used in this context."
 
Worked Days =

var _Edate = EOMONTH(today(),0)
var _Sdate = EOMONTH(today(),-1)+1
var _data = SUMMARIZECOLUMNS(
Claims_History[Date].[Date],
filter(Claims_History, related(KAM_STAFF[FullName]) = pending[fullname]),
filter(Claims_History, Claims_History[Date].[Date] >= _Sdate && Claims_History[Date].[Date] <= _Edate),
"count",count(Claims_History[AN]))

return

COUNTROWS(_data)

ah so simple! i was having a moment and was just trying count() rather than countx! 

 

ended up using count rows as per your advice! 

 

thank you! 

 

 

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors