Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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.
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.
Do you have these months created as text value? If yes, here is the solution:
for you specifically it would be:
IF(SELECTEDVALUE('Table'[Month]) = currentMonth, Calculation1, Calculation2)
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 ;)
User | Count |
---|---|
98 | |
90 | |
78 | |
72 | |
65 |
User | Count |
---|---|
114 | |
97 | |
95 | |
68 | |
65 |