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.
Hello,
I hope find you well.
I have a problem.
To have the sum per line I used the measure:
Solved! Go to Solution.
Hi @sara_pinto15 ,
After understanding your problem, here is the solution I have for you.
This is the original table data. The name of the table is Table.
Create a measure that selects the maximum version of the ID with Status being y.
Measure = var _maxversion=CALCULATE(max('Table'[Version]), FILTER(ALLSELECTED('Table'),'Table'[ID]=SELECTEDVALUE('Table'[ID])&& 'Table'[Status]="y"))
return CALCULATE(sum('Table'[Value]), FILTER( 'Table' , 'Table'[Version]=_maxversion&&'Table'[Status]="y"))
Create another measure that shows the total value of the calculation.
TotalValue = SUMX(VALUES('Table'[ID]),[Measure])
Then the desired results can be achieved.
Best regards,
Erica Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @sara_pinto15 ,
After understanding your problem, here is the solution I have for you.
This is the original table data. The name of the table is Table.
Create a measure that selects the maximum version of the ID with Status being y.
Measure = var _maxversion=CALCULATE(max('Table'[Version]), FILTER(ALLSELECTED('Table'),'Table'[ID]=SELECTEDVALUE('Table'[ID])&& 'Table'[Status]="y"))
return CALCULATE(sum('Table'[Value]), FILTER( 'Table' , 'Table'[Version]=_maxversion&&'Table'[Status]="y"))
Create another measure that shows the total value of the calculation.
TotalValue = SUMX(VALUES('Table'[ID]),[Measure])
Then the desired results can be achieved.
Best regards,
Erica Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
This works perfectly! Thank you very much 😊
hi, @sara_pinto15
measure =
SUMX(
FILTER(
'Table','Table'[version ] =CALCULATE(MAX('Table'[version]),
'Table'[status]="y",ALLEXCEPT('Table','Table'[id]))
),
'Table'[value]
)
Thank you for your help.
But this solution gives me this:
Thanks anyway 😊
Hi, @sara_pinto15
with above data you provide my measure give as you want
but it seems something another thing present in your real data.
see below screenshort
Try this:
TotalValue_StatusY =
SUMX(VALUES(Table[ID]),
CALCULATE(SUM('Table'[Value]),
'Table'[Status]="y",
'Table'[Version]=MAX('Table'[Version])))
Thank you for your help.
But this solution gives me this:
Thanks anyway 😊
Certainly! Based on your description, you want to calculate the sum of values where the status is "y" but only for the latest version.
To achieve this, you can make use of the FILTER function along with the MAX function. Here's how you can modify your DAX measure to get the desired result:
.TotalValue_StatusY =
VAR MaxVersion = CALCULATE(MAX('Table'[Version]), 'Table'[Status] = "y")
RETURN
CALCULATE(
SUM('Table'[Value]),
'Table'[Status] = "y",
'Table'[Version] = MaxVersion
)
Here's a breakdown of what's happening in the measure:
By using this measure, you should get the sum of values for the latest version where the status is "y".
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.
Thank you for your help.
But this solution gives me this:
Thanks anyway 😊
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
46 | |
28 | |
23 | |
12 | |
8 |
User | Count |
---|---|
76 | |
51 | |
45 | |
16 | |
12 |