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
Tevon713
Helper IV
Helper IV

Sum value of column if contain specific text and display in table

Hi All. 

 

I have simple data as follow.  I want to sum up the Visit Amt if the Room Type is "ROOM".

Created this measure, Total VisitTime = CALCULATE(SUM('Table1'[VisitAmt]),FILTER('Table1', Table1'[Room Type]="ROOM"))

 

Acct Num Date Room Type Visit Amt
1 8/1/2022 ROOM                37
2 8/1/2022 ROOM                53
3 8/1/2022 Living                68
4 8/1/2022 ROOM                41
5 8/2/2022 ROOM                61
6 8/2/2022 ROOM                52
7 8/2/2022 Conference                67
8 8/2/2022 Conference                40
9 8/2/2022 ROOM                98
10 8/2/2022 ROOM                73
11 8/3/2022 ROOM                78
12 8/3/2022 Conference                65
13 8/3/2022 Living                54
14 8/3/2022 ROOM                61
15 8/4/2022 ROOM                40
16 8/4/2022 ROOM                78
17 8/4/2022 ROOM                34
18 8/4/2022 ROOM                67
19 8/4/2022 ROOM                58
    Total          1,125
       

 

Ideally should look like this... I'm getting something different when pushing in table or matrix giving the total for listed date.

 

Tevon713_0-1667858683484.png

 

 

Tevon713_1-1667858735033.png

1 ACCEPTED SOLUTION
MDodds
Resolver II
Resolver II

Hi Tevon,

 

I tried recreating this using your data and my formulas seem to work, although they are no different from yours.
Only thing I can see is some minor differences in your syntax re apostrophes. Try my DAX below:

Room Only = Calculate(Sum(Table1[Visit Amt]),Filter(Table1, Table1[Room Type] = "ROOM"))
Produces the following result:
MDodds_0-1667864064700.png

 

If still stuck I can either send you my PBIX where I tried this out, or you could send me yours for review?

 

Cheers



View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-yanjiang-msft
Community Support
Community Support

Hi @Tevon713 ,

My test result is the same with @MDodds 's. An alternative, you can simply only select ROOM in the visual filter of Room Type column, and just put the VisitAmt column in the visual without a measure.

vkalyjmsft_0-1667874845982.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

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

MDodds
Resolver II
Resolver II

Hi Tevon,

 

I tried recreating this using your data and my formulas seem to work, although they are no different from yours.
Only thing I can see is some minor differences in your syntax re apostrophes. Try my DAX below:

Room Only = Calculate(Sum(Table1[Visit Amt]),Filter(Table1, Table1[Room Type] = "ROOM"))
Produces the following result:
MDodds_0-1667864064700.png

 

If still stuck I can either send you my PBIX where I tried this out, or you could send me yours for review?

 

Cheers



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.