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
Jane689
Helper I
Helper I

multiple columns in calculate function

Hi ,

I have created below measure  -

measure  = CALCULATE(SUM(table[visits]),Allselected(table[pagename]))

 

but i want to take sum of other columns also .

 

Let me know how can i incorporate, other columns like filedownloads,videos

 

Am getting error when i tried this -

measure  = CALCULATE(SUM(table[visits]),SUM(table[filedownloads]),SUM(table[videos]),Allselected(table[pagename]))

1 ACCEPTED SOLUTION
v-rongtiep-msft
Community Support
Community Support

Hi @Jane689 ,

I have created a simple sample, please refer to it to see if it helps you.

Create 2 measures.

Measure = MAX('Table'[videos])+MAX('Table'[filedownloads])+MAX('Table'[visits])
Measure 2 = var _b=SUMMARIZE('Table','Table'[pagename],"aaa",[Measure])
return
IF(HASONEVALUE('Table'[pagename]),[Measure],SUMX(_b,[aaa]))

vpollymsft_0-1668490754192.png

If it still does not help, please provide more details with your desired output and pbix file without privacy information.

 

Best Regards

Community Support Team _ Polly

 

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

4 REPLIES 4
v-rongtiep-msft
Community Support
Community Support

Hi @Jane689 ,

I have created a simple sample, please refer to it to see if it helps you.

Create 2 measures.

Measure = MAX('Table'[videos])+MAX('Table'[filedownloads])+MAX('Table'[visits])
Measure 2 = var _b=SUMMARIZE('Table','Table'[pagename],"aaa",[Measure])
return
IF(HASONEVALUE('Table'[pagename]),[Measure],SUMX(_b,[aaa]))

vpollymsft_0-1668490754192.png

If it still does not help, please provide more details with your desired output and pbix file without privacy information.

 

Best Regards

Community Support Team _ Polly

 

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

Jane689
Helper I
Helper I

@Jihwan_Kim 

 

Thanks for the input.

 

I need to use this measure as values in matrix visual and show visits,file downloads and videos in different rows.

 

The solution that you have provided sums up all 3 columns but i need to show these 3 separately .

Hi,

Thank you for your feedback.

Please share your sample pbix file's link together with how your desired outcome of the visualization looks like, and then I can try to look into it to come up with a more accurate solution.

Thanks.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your datamodel looks like, but please try the below whether it suits your requirement.

 

new measure =
CALCULATE (
    SUMX ( table, table[visits] + table[filedownloads] + table[videos] ),
    ALLSELECTED ( table[pagename] )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


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.