Forum Discussion
sum column
- 6 years ago
Hi LeaRupnik ,
Try this:
1. Create a Calendar table.
Calendar = CALENDAR ( DATE ( 2019, 1, 1 ), DATE ( 2019, 12, 31 ) )2. Create columns in Calendar table.
Month = MONTH('Calendar'[Date])Month Name = FORMAT('Calendar'[Date],"mmm")3. Create relationship.
4. Create measures.
MTD = TOTALMTD(SUM('Table'[quantiti]),'Calendar'[Date])YTD = IF ( NOT ( ISBLANK ( MAX ( 'Table'[quantiti] ) ) ), TOTALYTD ( SUM ( 'Table'[quantiti] ), 'Calendar'[Date] ) )PBIX file attached.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello,
this is work, but i have a table more complicated.
I have quantity according to date, then i have to sum a quantity to month, then to each month together.
ia have that kind of problem
| date | quantiti | |
| 1.02.2019 | 2 | |
| 12.02.2019 | 5 | |
| 14.02.2019 | 5 | |
| 3.03.2019 | 4 | |
| 5.03.2019 | 6 | |
| 5.04.2019 | 2 | |
| 6.04.2019 | 5 |
|
and i would like to get this
| feb | 12 | 12 |
| mar | 10 | 22 |
| apr | 7 | 29 |
| 29 |
thx Lea
Hi LeaRupnik ,
Try this:
1. Create a Calendar table.
Calendar = CALENDAR ( DATE ( 2019, 1, 1 ), DATE ( 2019, 12, 31 ) )2. Create columns in Calendar table.
Month = MONTH('Calendar'[Date])Month Name = FORMAT('Calendar'[Date],"mmm")3. Create relationship.
4. Create measures.
MTD = TOTALMTD(SUM('Table'[quantiti]),'Calendar'[Date])YTD =
IF (
NOT ( ISBLANK ( MAX ( 'Table'[quantiti] ) ) ),
TOTALYTD ( SUM ( 'Table'[quantiti] ), 'Calendar'[Date] )
)PBIX file attached.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- LeaRupnik6 years agoHelper III
i a new in this, in Power bi and the forum.
The solution witch post it work. Now a have a problem how to sort the short month name. I don't want the number month.
tnx
Lea