Forum Discussion
Getting filter result from selected period
Hi Guys
I need your magic help here .
actually im having a data ( attached below )
| region_nm | branch | provinsi | kabkota | item_nm | brand_nm | month | metric | val | val_target |
| REGION 3 | MAKASSAR | SULAWESI BARAT | POLEWALI MANDAR | ITEM 6 | BRAND 2 | 01/08/2021 | Quantity | 2685 | 1937 |
| REGION 1 | PEKANBARU | KEPULAUAN RIAU | KARIMUN | ITEM 6 | BRAND 2 | 01/04/2022 | Quantity | 52902 | 42342 |
| REGION 3 | MAKASSAR | SULAWESI BARAT | POLEWALI MANDAR | ITEM 4 | BRAND 2 | 01/11/2022 | Quantity | 3869 | 4059 |
| REGION 3 | MANADO | SULAWESI BARAT | MAMUJU UTARA | ITEM 6 | BRAND 2 | 01/09/2021 | Quantity | 614 | 563 |
| REGION 3 | MAKASSAR | SULAWESI BARAT | POLEWALI MANDAR | ITEM 5 | BRAND 1 | 01/07/2022 | Quantity | 2408 | 2177 |
| REGION 3 | MANADO | MALUKU UTARA | KOTA TERNATE | ITEM 3 | BRAND 1 | 01/10/2022 | Quantity | 828 | 1018 |
| REGION 3 | MANADO | MALUKU UTARA | KOTA TIDORE KEPULAUAN | ITEM 2 | BRAND 2 | 01/12/2021 | Quantity | 179 | 168 |
| REGION 3 | MAKASSAR | SULAWESI BARAT | MAJENE | ITEM 5 | BRAND 1 | 01/09/2022 | Quantity | 461 | 519 |
| REGION 3 | MAKASSAR | SULAWESI BARAT | MAMASA | ITEM 6 | BRAND 2 | 01/10/2022 | Quantity | 1304 | 1618 |
here my goals is , when i select a period on filter , let say january 2022.
the chart and data only showing data within 1 year ( january 2021 - january 2022 )
kindly help me for that , help with attached powerbi file would be a great help
many thanks
SE
- Anonymous3 years ago
You can create a date table first
e.g
Table 2 = CALENDAR(DATE(YEAR(MIN('Table'[month])),1,1),DATE(YEAR(MAX('Table'[month])),12,31))The relationship between two table
Then create a measure
Measure = var a=MIN('Table 2'[Date]) var b= EOMONTH(a,-13)+1 return CALCULATE(SUM('Table'[val]),CROSSFILTER('Table'[month],'Table 2'[Date],None),'Table'[month]<=EOMONTH(a,0)&&'Table'[month]>b)Then put the measure to the table visual and put the column of date table to slicer.
Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
1 Reply
- AnonymousNot applicable
You can create a date table first
e.g
Table 2 = CALENDAR(DATE(YEAR(MIN('Table'[month])),1,1),DATE(YEAR(MAX('Table'[month])),12,31))The relationship between two table
Then create a measure
Measure = var a=MIN('Table 2'[Date]) var b= EOMONTH(a,-13)+1 return CALCULATE(SUM('Table'[val]),CROSSFILTER('Table'[month],'Table 2'[Date],None),'Table'[month]<=EOMONTH(a,0)&&'Table'[month]>b)Then put the measure to the table visual and put the column of date table to slicer.
Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.