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 Experts,
I have a table as mentioned below:
DateField | Value | Category |
01-01-2020 | 1 | A |
02-01-2020 | 10 | A |
03-01-2020 | 100 | A |
04-01-2020 | 100 | A |
03-01-2020 | 100 | B |
04-01-2020 | 100 | B |
I want to plot accumulated values on a graph. The catch here is, if i select a period of 01-Jan-2020 to 04-Jan-2021 and plot two lines for Categories A and B, the value of the first datapoint(one with minimum date) for each category should be subtracted from each and every data point(including the first point; thus making it zero). The dax mentioned below gives me the result when i browse the values by category:
Cumulative value =
CALCULATE(
SUM('MyTable'[Value]),
FILTER(
ALLSELECTED('MyTable'[DateField]) ,
ISONORAFTER('MyTable'[DateField], MAX('MyTable'[DateField]), DESC)
)
)
-
CALCULATE(SUM('MyTable'[Value])
,FILTER(ALLSELECTED('MyTable'[DateField]), 'MyTable'[DateField] = CALCULATE(MIN('MyTable'[DateField]),ALLSELECTED('MyTable'[DateField]))))
Although, this measure does not work when i try to browse the value at an overall level and not by category.
I could group it by category to get the sum of the values, but subtracting first value for each group is where i am stuck at.
Asking you experts for your help.
Kind Regards,
Chetan
Solved! Go to Solution.
Hi, @Anonymous
Please check the below picture and the sample pbix file's link, whether it is what you are looking for.
All measures are in the sample pbix file, and all steps are numbered in front of each measure.
https://www.dropbox.com/s/fabheo5e695rgij/chetanam.pbix?dl=0
Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
Linkedin: linkedin.com/in/jihwankim1975/
Twitter: twitter.com/Jihwan_JHKIM
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.
Hi, @Anonymous
Please check the below picture and the sample pbix file's link, whether it is what you are looking for.
All measures are in the sample pbix file, and all steps are numbered in front of each measure.
https://www.dropbox.com/s/fabheo5e695rgij/chetanam.pbix?dl=0
Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
Linkedin: linkedin.com/in/jihwankim1975/
Twitter: twitter.com/Jihwan_JHKIM
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.
@Anonymous , Not sure, I got it completely. Based on what I got Try like
Cumulative value =
CALCULATE(
SUM('MyTable'[Value]),
FILTER(
ALLSELECTED('MyTable'[DateField]) ,
ISONORAFTER('MyTable'[DateField], MAX('MyTable'[DateField]), DESC) && 'MyTable'[Category] ="A"
)
)
-
CALCULATE(
SUM('MyTable'[Value]),
FILTER(
ALLSELECTED('MyTable'[DateField]) ,
ISONORAFTER('MyTable'[DateField], MAX('MyTable'[DateField]), DESC) && 'MyTable'[Category] ="B"
)
)
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 |
---|---|
111 | |
94 | |
83 | |
67 | |
59 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |