The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi All
Below expression working fine , when click , it will select , Year = 2021 , Month = 2
Solved! Go to Solution.
Hi @admin11 ,
Try this column:
Please accept this as a solution if your question has been answered !!
Appreciate a Kudos 😀
Hi, @admin11
You can try the following expression.
Current Year =
IF (
AND (
MONTH ( 'Date'[Date] )
= MONTH ( NOW () ) - 1,
YEAR ( 'Date'[Date] ) = YEAR ( NOW () )
),
FORMAT ( EDATE ( NOW (), -1 ), "YYYY" )
)
If it doesn't work, please let me known what fields and visual types you used in your snipping.
Best Regards,
Caiyun Zheng
Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @admin11
You can try the following expression.
Current Year =
IF (
AND (
MONTH ( 'Date'[Date] )
= MONTH ( NOW () ) - 1,
YEAR ( 'Date'[Date] ) = YEAR ( NOW () )
),
FORMAT ( EDATE ( NOW (), -1 ), "YYYY" )
)
If it doesn't work, please let me known what fields and visual types you used in your snipping.
Best Regards,
Caiyun Zheng
Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous
Hi All
Thank you for your sharing , it work fine now.
I notice that your expression , does not include year 2021 , so i guess , when year =2022 , this when trigger this button , it will turn on year = 2022 right ?
Can you share with me how to modify the expression , so that it will turn on March ( Current month ). Meaning it will auto select year=2021 Current year & month = march ( current Month )
Paul
Hi, @admin11
It will select current year. If current year is 2021, it will get 2021. If current year is 2022, it will get 2022.
If you want get current year and current month, you can try this expression.
Current Month =
IF (
AND (
MONTH ( 'Date'[Date] ) = MONTH ( NOW () ),
YEAR ( 'Date'[Date] ) = YEAR ( NOW () )
),
FORMAT ( NOW (), "MMM-YYYY" )
)
Best Regards,
Caiyun Zheng
Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello @admin11 ,
try this,
Hi @admin11 ,
Try this column:
Please accept this as a solution if your question has been answered !!
Appreciate a Kudos 😀
Your expression work fine.
But i only wanted to select Current year only.
now your expression also select current month-1.
Can you advise how to make it only select year =2021 and not select Feb ?
Paul
Hi Paul,
No need to change the expression, select the visual and use Edit interaction to stop other visuals from interacting with the selected visual
Regards
Amine Jerbi
If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook
User | Count |
---|---|
82 | |
82 | |
35 | |
32 | |
32 |
User | Count |
---|---|
93 | |
79 | |
62 | |
54 | |
51 |