Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hello guys,
I have a measure in dax which shows values for selected Year/Quarter in a slicer. I need to create another one which will show the results for the same Quarter but a Year back.Is there any dax function which might help ? I take the slicer from the column below so a YEAR -1 wont help me.
Solved! Go to Solution.
Hi @TomaKavi ,
If you want, for example, select 2022/Q3 in the slicer, but the result returns the value of 2021/Q3. Then the table of this slicer field needs to have no relationship to the table in your results visual.
Here's an example for reference.
The main table:
The YearQuarter table:
No relationship:
Create a measure as the visual-level filter.
Measure = var _year=SELECTEDVALUE('YearQuarter'[Year])
var _quarter=SELECTEDVALUE('YearQuarter'[Quarter2])
return IF(ISFILTERED('YearQuarter'[YearQuarter]),IF(_year-1=MAX('Table'[Year])&&_quarter=MAX('Table'[Quarter2]),1),1)
Now the table visual is from the main table. And the slicer is from the YearQuarter tabel.
Put the measure into the visual-level filters in the table visual. Set up show items when the values is 1.
Result:
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @TomaKavi ,
If you want, for example, select 2022/Q3 in the slicer, but the result returns the value of 2021/Q3. Then the table of this slicer field needs to have no relationship to the table in your results visual.
Here's an example for reference.
The main table:
The YearQuarter table:
No relationship:
Create a measure as the visual-level filter.
Measure = var _year=SELECTEDVALUE('YearQuarter'[Year])
var _quarter=SELECTEDVALUE('YearQuarter'[Quarter2])
return IF(ISFILTERED('YearQuarter'[YearQuarter]),IF(_year-1=MAX('Table'[Year])&&_quarter=MAX('Table'[Quarter2]),1),1)
Now the table visual is from the main table. And the slicer is from the YearQuarter tabel.
Put the measure into the visual-level filters in the table visual. Set up show items when the values is 1.
Result:
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
hello, thanks, can work, but I have already created a different method. I have added another column in the date table, set 42022 for example as 4th Q for Y2022, set that as whole number, and in var where is selected specific Y/Q to use the new colum -1 and job done. But your solution will work as well
Hey @TomaKavi
You can create the column using the DAX bellow:
Kind Regards,
Marcel
Regards,
Marcel Magalhães
Microsoft Power BI Official Partner
MCT | Certified PL-300 Power BI
maybe I am doing something wrong, but this wont work.
Are you creating a Column? You need create a New Column in table date instead of a measure.
And, in instead of [date] you should use the name of your date column.
Regards,
Marcel Magalhães
Microsoft Power BI Official Partner
MCT | Certified PL-300 Power BI
User | Count |
---|---|
93 | |
84 | |
78 | |
75 | |
66 |
User | Count |
---|---|
115 | |
105 | |
93 | |
65 | |
60 |