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
Himanshi0291
Helper II
Helper II

SUM column values on one table based on applying filters on another table column

Hi,

 

I want to sum a column values of one table based on applying filters on another table column. I tried the below one but it is not working. Can you please assist.

 

Over Time = CALCULATE(SUM(DK_Time_Temp[OvtHrs],FILTER(DK_Projects, LEFT(DK_Projects[WBS1], 1 ) <> "0" )))
1 ACCEPTED SOLUTION

Hi, @Himanshi0291 

 

DAX is the language you use when you create transformations in the Power BI Desktop main screens rather than via the query editor. While M is the query language that can be viewed in the Power Query Editor. This query editor is accessed using the Edit Queries button in Power BI Desktop. It has no effect on the date type in 'Query Editor'. The aggregation calculation should work for numeric columns. You need to modify the data type as 'decimal number'. As a workaround, you may also use Value Function to Converts a text string that represents a number to a number.

 

Best Regards

Allan

 

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

View solution in original post

3 REPLIES 3
az38
Community Champion
Community Champion

Hi @Himanshi0291 

you forgot the closing parethesys ")"

Over Time = CALCULATE(SUM(DK_Time_Temp[OvtHrs]), FILTER(DK_Projects, LEFT(DK_Projects[WBS1], 1 ) <> "0" ) )


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Hi,

Thanks for your reply on this. The problem that I am facing with this query is that SUM function isnt working with column name "OvtHrs' that has data type 'Text'. There is no visualization and it says " SUM function cannot work with values of type String". If I change the data type to "Decimal number' in my table, What impacts do i keep in mind?

- Does it permanently change the data type in the database?

- Will it corrupt the figures already saved in this column in the table? 

Data type.PNG

Please help.

 

Thanks. 

Hi, @Himanshi0291 

 

DAX is the language you use when you create transformations in the Power BI Desktop main screens rather than via the query editor. While M is the query language that can be viewed in the Power Query Editor. This query editor is accessed using the Edit Queries button in Power BI Desktop. It has no effect on the date type in 'Query Editor'. The aggregation calculation should work for numeric columns. You need to modify the data type as 'decimal number'. As a workaround, you may also use Value Function to Converts a text string that represents a number to a number.

 

Best Regards

Allan

 

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

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.