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
Leyla
Regular Visitor

Calculate the sum of a measure by text field

I have the list of Regions, functions, the related BPEs and values for the current and previous quarters. By using Measure I created formulas that first compare current vs previous quarter for values, if change happened then it assigns 1, if no change 0. The count of changes is stored as a Measure not as a column within the table. Now I want to summarise by Region and the function the number of changes, i.e. how many 1 I have for Region 1 and function1, then for Region2, function2, etc. As calculated measures are not tables I cannot use Sum formula as it requires to reference to the table but when I reference to a table it does not have the calculated leasure as a separate column to be chosen for summing. Currently the calculated Measure shows only 1 or 0 but I need the sum by Region and Function.

Capture.PNG

1 ACCEPTED SOLUTION
v-yuezhe-msft
Employee
Employee

@Leyla,

Create the following measure in your table. If the DAX doesn't return your expected result, please share sample data of your table which we can copy and paste here. Also please post DAX formula of [Count any change] here.

Measure  =
SUMX (
    SUMMARIZE (
        'Append1',
        'Append1'[Regions],
        'Append1'[functions],
        "temp", [Count any change]
    ),
    IF ( ISERROR ( [temp] ), 0, [temp] )
)



Regards,
Lydia

 

Community Support Team _ Lydia Zhang
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

2 REPLIES 2
v-yuezhe-msft
Employee
Employee

@Leyla,

Create the following measure in your table. If the DAX doesn't return your expected result, please share sample data of your table which we can copy and paste here. Also please post DAX formula of [Count any change] here.

Measure  =
SUMX (
    SUMMARIZE (
        'Append1',
        'Append1'[Regions],
        'Append1'[functions],
        "temp", [Count any change]
    ),
    IF ( ISERROR ( [temp] ), 0, [temp] )
)



Regards,
Lydia

 

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks a lot, this solved my problem. However, would be greatful if you could explain the meaning of "temp".

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.