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
sdhn
Responsive Resident
Responsive Resident

Getting one extra count.

Hello All,

 

I have a measure as

 

OpenNMSCounts = COUNTROWS(ALLSELECTED(Source)) -1
 
I am getting one extra count. 
For eg:
 
Totals Rows are "30" but its dispalys as: "31".  Any help will be appreciated.  Thanks 
10 REPLIES 10
sdhn
Responsive Resident
Responsive Resident

Getting error:

 

"The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value."

Hi @sdhn 

 

Try to add a column from your table to the formula:

OpenNMSCounts = Distinct(ALLSELECTED(Source[Column])) 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

sdhn
Responsive Resident
Responsive Resident

It was my mistake. I rephrase my question. 

 

I have merged multiple files onto one file during transformation & load. New file is called Source.
Source. Name column has all files name. This column has created by load process. 
 
 
Below  measure is counting one extra row.  I want exact rows.

 

we are using following measure to get total counts of each types or files.

 

Source = CALCULATE(COUNT(Source[Source.Name]), ALLEXCEPT(Source,Source[Source.Name]))
 
 

Hi @sdhn 

 

Try this:

Source =
CALCULATE (
    COUNTROWS ( VALUES ( Source[Source.Name] ) ),
    ALLEXCEPT ( Source, Source[Source.Name] )
)

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

sdhn
Responsive Resident
Responsive Resident

It change to 

 

count fo all files  only one row count as below:  

 

sdhn_0-1642033902218.png

 

With old code :

sdhn_1-1642034032806.png

 

 

@sdhn 

 

Can you post sample data as text and expected output? or the PBIX file?


The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.
4. Relation between your tables

Appreciate your Kudos!!
LinkedIn:www.linkedin.com/in/vahid-dm/

sdhn
Responsive Resident
Responsive Resident

How to upload files. Thanks 

Upload to https://wetransfer.com/ and share thr link here

@sdhn 

VahidDM
Super User
Super User

Hi @sdhn 

 

Try this:

OpenNMSCounts = Distinct(ALLSELECTED(Source)) 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

sdhn
Responsive Resident
Responsive Resident

Did not work out.  Error 

 

screen grayed out 

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.

Top Solution Authors