Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hello All,
I am very new to Power bi.
I have a Date and Season and Fact Table.
They are connected with 1-many reations.
In seasons table I have 2 seasons(F and S)
The season F is from previous year March to November (Season F22 = March 2021- Nov 2021 )
The season S is from previous year December to Feb (Season F22 = December 2021- Feb 2021 )
My ask is , If user selects a date then it shoud show the current year(whate ever is the selected date) and previous year dates in a bar chart to compare data. Dates are not sequential we need to compare to the closest dates
This is to compare data by dates with season.
Solved! Go to Solution.
Hi @Kate_newmember ,
I can't download your pbix file.
But you can have a try.
Disabling relationships between date tables and other tables. Then create a measure.
measure =
VAR _selectedvalue =
SELECTEDVALUE ( date[date] )
VAR _1yearago =
EDATE ( _selectedvalue, -12 )
VAR _value =
CALCULATE (
MAX ( table[value] ),
FILTER ( ALL ( table ), table[date] = _1yearago )
)
VAR _datediff =
DATEDIFF ( _1yearago, MAX ( date[date] ), DAY )
VAR _minx =
MINX ( ALL ( date ), _datediff )
VAR _minxvalue =
CALCULATE (
MAX ( table[value] ),
FILTER ( ALL ( table ), table[date] = _minx )
)
RETURN
IF ( _value = blank, _minxvalue, _value )
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Kate_newmember ,
I can't download your pbix file.
But you can have a try.
Disabling relationships between date tables and other tables. Then create a measure.
measure =
VAR _selectedvalue =
SELECTEDVALUE ( date[date] )
VAR _1yearago =
EDATE ( _selectedvalue, -12 )
VAR _value =
CALCULATE (
MAX ( table[value] ),
FILTER ( ALL ( table ), table[date] = _1yearago )
)
VAR _datediff =
DATEDIFF ( _1yearago, MAX ( date[date] ), DAY )
VAR _minx =
MINX ( ALL ( date ), _datediff )
VAR _minxvalue =
CALCULATE (
MAX ( table[value] ),
FILTER ( ALL ( table ), table[date] = _minx )
)
RETURN
IF ( _value = blank, _minxvalue, _value )
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
25 | |
12 | |
9 | |
9 | |
9 |
User | Count |
---|---|
19 | |
14 | |
14 | |
13 | |
12 |