Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
santigc97
Frequent Visitor

Problem with Totals and Minimum

Hello everyone,

 

I have a problem with a table, I have a measure and I want a sum on the total, is there an option to modify the totals and so a sum like a pivot table on Excel? I have tried another option and it is to create a modified measure but I don't achieve the correct result.

Note that in the table (I exported it) I have the sum but for all the classes without filtering in the total (it is a test) and in the one that is without the hasonevalue I have the minimum.

 

SalarioMinimo =
VAR MinimoValor =
MINX(
FILTER(
TEST,
TEST[Atributo] = "7. SALARY" && TEST[Valor] < 0 && TEST[Weeks] = "W 0-3"
),
TEST[Valor]
)
RETURN
IF(ISBLANK(MinimoValor), BLANK(), MinimoValor)

 

 

SalarioMinimoTotal =
VAR MinimoValor =
MINX(
FILTER(
TEST,
TEST[Atributo] = "7. SALARY" && TEST[Valor] < 0 && TEST[Weeks] = "W 0-3"
),
TEST[Valor]
)
RETURN
IF(HASONEVALUE(TEST[Location Risks]),
IF(ISBLANK(MinimoValor), BLANK(), MinimoValor),
SUMX(VALUES(TEST[Location Risks]),MinimoValor))
 
The total that i want is -1190 (the sum of all of the negatives)
santigc97_0-1710330237389.png

 


 

1 ACCEPTED SOLUTION

Hi @santigc97 

 

I would like to apologize for the belated reply.

 

After my test, you can use the following measure:

SalarioMinimo = 
VAR MinimoValor =
SUMX(
FILTER(
TEST,
TEST[Atributo] = "7. SALARY" && TEST[Valor] < 0 && TEST[Weeks] = "W 0-3"
),
TEST[Valor]
)
RETURN
IF(ISBLANK(MinimoValor), BLANK(), MinimoValor)

 

Result:

vxuxinyimsft_0-1712131030456.png

 

Best Regards,
Yulia Xu

 

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
v-xuxinyi-msft
Community Support
Community Support

Hi @santigc97 

 

I have understood your requirement but I am not able to reproduce your formulas without sample data, can you provide PBIX file or sample data in excel or screenshot form? This will make it easier for us to find the solution. Please remove any sensitive data in advance. If uploading pbix files please do not log into your account.

 

Best Regards,
Yulia Xu

Hello!

 

Thanks for your repply

 

Find part of my dataset (you need to introduce it as table and call it TEST, also it is in a bad format you can copy paste it).

 

Note that i want the sum of mins (if the value is positive i prefer to not appear) and with the sum of the totals (-1165-21-4)=-1190 instead of the minimal value that is -1165

 

Measure 1

 

SalarioMinimo =
VAR MinimoValor =
MINX(
FILTER(
TEST,
TEST[Atributo] = "7. SALARY" && TEST[Valor] < 0 && TEST[Weeks] = "W 0-3"
),
TEST[Valor]
)
RETURN
IF(ISBLANK(MinimoValor), BLANK(), MinimoValor)
 
Measure 2
 
SalarioMinimoTotal =
VAR MinimoValor =
MINX(
FILTER(
TEST,
TEST[Atributo] = "7. SALARY" && TEST[Valor] < 0 && TEST[Weeks] = "W 0-3"
),
TEST[Valor]
)
RETURN
IF(HASONEVALUE(TEST[Location Risks]),
IF(ISBLANK(MinimoValor), BLANK(), MinimoValor),
SUMX(VALUES(TEST[Location Risks]),MinimoValor))

 

santigc97_1-1710338569839.png

 

 

WeeksPositionLocation RisksAtributoValor
W 0-3ManagerA7. SALARY-1165
W 0-3ManagerB7. SALARY-21
W 0-3ManagerC7. SALARY-4
W 0-3ManagerD7. SALARY0
W 3-5ManagerA7. SALARY1000
W 3-5ManagerB7. SALARY0
W 3-5ManagerC7. SALARY0
W 3-5ManagerD7. SALARY-5

Hi @santigc97 

 

I would like to apologize for the belated reply.

 

After my test, you can use the following measure:

SalarioMinimo = 
VAR MinimoValor =
SUMX(
FILTER(
TEST,
TEST[Atributo] = "7. SALARY" && TEST[Valor] < 0 && TEST[Weeks] = "W 0-3"
),
TEST[Valor]
)
RETURN
IF(ISBLANK(MinimoValor), BLANK(), MinimoValor)

 

Result:

vxuxinyimsft_0-1712131030456.png

 

Best Regards,
Yulia Xu

 

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

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.