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 ,
I am trying to calculate the year to date values for each month in a year but the max value
I tried viking the max and then applied the ytd calculation but getting incorrect value.
Solved! Go to Solution.
Hi @Mikelytics
Not necessarily
Description | Amount | Month-Year |
Salaries | 90,302 | Jan-2020 |
Salaries | 90,302 | Jan-2020 |
Salaries | 90,302 | Jan-2020 |
Rent | 1,383 | Jan-2020 |
Rent | 1,383 | Jan-2020 |
Rent | 1,383 | Jan-2020 |
Salaries | 89,283 | Feb-2020 |
Salaries | 89,283 | Feb-2020 |
Salaries | 89,283 | Feb-2020 |
Rent | 1,221 | Feb-2020 |
Rent | 1,221 | Feb-2020 |
Rent | 1,221 | Feb-2020 |
Expected results YTD
Decription | Jan-2020 | Feb-2020 |
Salaries | 90,302 | 179,585 |
Rent | 1,383 | 2,604 |
I want to find either the max or average of the duplicates in each month and use that to calculate the year to date
Hi @Sagejah9 ,
ok I think I understood. You want to extract per month the max value and use this in the YTD calculation right?
YTD of Monthly Max Item =
TOTALYTD(
SUMX(
VALUES('Dim Date'[Year-Month]),
CALCULATE(
MAX([Amount])
)
)
,'Dim Date'[Date]
)
Best regards
Michael
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your kudos.
Hi @Sagejah9 ,
Can you please give a little bit mor context what you want to achive?
Do you want the monthly MAX or the Daily max? What granularity has your data.
I give you an example. Lets say you have data on daily basis. but you want to see for the year to date the value of the MONTH with the MAX value.
If this is your requirement you can do the following:
MAX Monthly Value YTD =
TOTALYTD(
MAXX(
VALUES('Dim Date'[Month]),
[SUM Sales]
),
'Dim Date'[Date]
)
Please be aware that you should use an additional Date dimension table to make sure that TOTALYTD works properly and follows best practices.
Best regards
Michael
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your kudos.
Hi @Mikelytics
Not necessarily
Description | Amount | Month-Year |
Salaries | 90,302 | Jan-2020 |
Salaries | 90,302 | Jan-2020 |
Salaries | 90,302 | Jan-2020 |
Rent | 1,383 | Jan-2020 |
Rent | 1,383 | Jan-2020 |
Rent | 1,383 | Jan-2020 |
Salaries | 89,283 | Feb-2020 |
Salaries | 89,283 | Feb-2020 |
Salaries | 89,283 | Feb-2020 |
Rent | 1,221 | Feb-2020 |
Rent | 1,221 | Feb-2020 |
Rent | 1,221 | Feb-2020 |
Expected results YTD
Decription | Jan-2020 | Feb-2020 |
Salaries | 90,302 | 179,585 |
Rent | 1,383 | 2,604 |
I want to find either the max or average of the duplicates in each month and use that to calculate the year to date
Hi @Sagejah9 ,
ok I think I understood. You want to extract per month the max value and use this in the YTD calculation right?
YTD of Monthly Max Item =
TOTALYTD(
SUMX(
VALUES('Dim Date'[Year-Month]),
CALCULATE(
MAX([Amount])
)
)
,'Dim Date'[Date]
)
Best regards
Michael
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your kudos.
Please find attached a sample with your data example:
Your Sample
Date Table
Data model
Measure and result
Code:
YTD of Monthly Max Item =
TOTALYTD(
SUMX(
VALUES('DimDate'[Year-Month]),
CALCULATE(
MAX('Sample'[Amount])
)
)
,'DimDate'[Date]
)
Best regards
Michael
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your kudos.
Hi @Sagejah9 ,
I created a sample pbix file(see attachment) for you, please check whether that is what you want.
1. Create two measures as below to get it:
Measure =
VAR _tab =
SUMMARIZE (
'Table',
'Table'[Month-Year],
'Table'[Description],
'Table'[Amount]
)
RETURN
SUMX ( _tab, [Amount] )
Measure 2 =
SUMX (
FILTER (
ALLSELECTED ( 'Table'[Month-Year] ),
'Table'[Month-Year] <= SELECTEDVALUE ( 'Table'[Month-Year] )
),
[Measure]
)
2. Create a matrix visual as below screenshot
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
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 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
148 | |
111 | |
93 | |
84 | |
66 |