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.
Hi
New to Power BI so forgive me if this is simple...
I have data that looks like this:
Date | Code | Code2 | Value
1/1/2016 | MGH | TPN | 56
1/1/2016 | MMC | TPN | 45
1/1/2016 | CMC | TPN | 40
2/1/2016 | MGH | TPN | 76
2/1/2016 | MMC | TPN | 87
2/1/2016 | CMC | TPN | 56
1/1/2016 | MGH | ABT | 77
1/1/2016 | MMC | ABT | 87
1/1/2016 | CMC | ABT | 57
2/1/2016 | MGH | ABT | 78
2/1/2016 | MMC | ABT | 89
2/1/2016 | CMC | ABT | 59
The Value field is that months target number for CODE and CODE2. At the Month view the numbers are correct but at the Quarter and Year they are not as it is summing these numbers and what I really need to do is SUM the numbers for the latest date. For example, if the above dataset is all I have, for the year view I would like to show only the sum of the February numbers as this is the lastes date for the year for the dataset.
Not sure if I explained myself well enough but perhaps someone will understand! Thanks for any help.
Jeremy
Solved! Go to Solution.
In addition to Habib's solution, you can also use LASTDATE function to get the last date in the Quarter and Year. See my sample below.
I assume you have a table called "MyTestTable" like below.
Then you should be able to use the formula below to create a new measure to SUM the Value for the latest date and show it on the report.
Measure 2 = CALCULATE ( SUM ( MyTestTable[Value] ), LASTDATE ( MyTestTable[Date] ) )
Regards
In addition to Habib's solution, you can also use LASTDATE function to get the last date in the Quarter and Year. See my sample below.
I assume you have a table called "MyTestTable" like below.
Then you should be able to use the formula below to create a new measure to SUM the Value for the latest date and show it on the report.
Measure 2 = CALCULATE ( SUM ( MyTestTable[Value] ), LASTDATE ( MyTestTable[Date] ) )
Regards
You can achieve this by adding a new measure using below formula. I have named dataset as "Sample" in below DAX.
Measure = CALCULATE(SUM('Sample'[Value]),FILTER('Sample','Sample'[Date]=MAX('Sample'[Date])),ALLSELECTED('Sample'))
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 |
---|---|
110 | |
99 | |
80 | |
64 | |
57 |
User | Count |
---|---|
145 | |
110 | |
91 | |
84 | |
66 |