Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

DAX to check if the month filter passed from the matrix visual = current month

 Hi.

I need help with the following scenario please,

I have a matrix visual with month of the fiscal year as columns.I have to write dax for the logic if month in the matrix is current month do calculation1 and for all the past and future months of the year do calculation2. In the example, If the current in feb, for the matrix column Feb,I should display the value of calculation1.For all the other months I should show the value of calculation2. Hope I made th question clear. 

 

Divya_Amar_1-1676499601910.png

 

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

Assuming the year and month name have been dragged from the Calendar Table, write this measure

=if(and(today()>=min(calendar[date]),today()<=max(calendar[date])),[measure1],[measure2])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
PawelWrona
Resolver I
Resolver I

Do you have these months created as text value? If yes, here is the solution:

PawelWrona_0-1676507850722.png


for you specifically it would be:
IF(SELECTEDVALUE('Table'[Month]) = currentMonth, Calculation1, Calculation2)

Anonymous
Not applicable

Thanks Pawel. Will SELECTEDVALUE apply for filtering through matrix visual column? I thought SELECTEDVALUE can only be used for filters applied through FILTERING Pane.Please correct me if I am wrong.

Yes, it will work to get the current value from column or row level as well. Depends how you use it ;⁠)

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.