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.
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.
User | Count |
---|---|
16 | |
8 | |
7 | |
6 | |
5 |
User | Count |
---|---|
25 | |
13 | |
12 | |
8 | |
8 |