Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi All,
I have data like below table.
Source of data - Excel
Req - calculate current year current month of A,B,C
| Month | A | B | C |
| 2021-00 | 0.200 | 0.900 | 0.650 |
| 2022-01 | 0.400 | 0.66 | 0.23 |
| 2022-02 | 0.200 | 0.900 | 0.650 |
| 2022-03 | 0.400 | 0.66 | 0.23 |
| 2022-04 | 0.200 | 0.900 | 0.650 |
| 2022-05 | 0.400 | 0.66 | 0.23 |
| 2022-06 | 0.200 | 0.900 | 0.650 |
| 2022-07 | 0.400 | 0.66 | 0.23 |
| 2022-08 | 0.200 | 0.900 | 0.650 |
| 2022-09 | 0.400 | 0.66 | 0.23 |
| 2022-10 | 0.200 | 0.900 | 0.650 |
| 2022-11 | 0.400 | 0.66 | 0.23 |
| 2022-12 | 0.400 | 0.66 | 0.23 |
| 2022-00 | 0.400 | 0.66 | 0.23 |
Please help me to write dax.
Thanks.
Solved! Go to Solution.
Hi @Smartnag ,
Here are the steps you can follow:
1. Create measure.
Flag =
var _flag=
VALUE(
LEFT(MAX('Table'[Month]),4))
var _currentyear=
YEAR(TODAY())
return
IF(
_flag=_currentyear,1,0)2. Set [A], [B], [C] to Sum.
3. Place [Flag]in Filters, set is=1, apply filter.
4. Result:
If you need pbix, please click here.
Current month from year & month (format).pbix
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @Smartnag ,
Here are the steps you can follow:
1. Create measure.
Flag =
var _flag=
VALUE(
LEFT(MAX('Table'[Month]),4))
var _currentyear=
YEAR(TODAY())
return
IF(
_flag=_currentyear,1,0)2. Set [A], [B], [C] to Sum.
3. Place [Flag]in Filters, set is=1, apply filter.
4. Result:
If you need pbix, please click here.
Current month from year & month (format).pbix
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
<checks calendar> yup, normal years still have 12 months, not 13. What does "2021-00" mean in your context?
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 41 | |
| 38 | |
| 36 | |
| 30 | |
| 28 |
| User | Count |
|---|---|
| 128 | |
| 88 | |
| 79 | |
| 67 | |
| 62 |