Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi Everyone.
I have two table name Date table and fact table. I have date slicer that is using Date Table. Date table is connected with startdate column. I would like to display the Average of column score in fact table if the slicer selection is between column startdate and enddate. Anyone have idea how to do this?
Thank you!
Solved! Go to Solution.
Hi @Anonymous
Try this measure:
Avg. Score Selected Date =
Var _Max_Selected_Date = MAX('Date table'[Date])
Var _Filtered_Fact_Table =
CALCULATETABLE(
FILTER(
'Fact Table',
'Fact Table'[StartDate]<=_Max_Selected_Date&&'Fact Table'[EndDate]>=_Max_Selected_Date
),
CROSSFILTER('Date table'[Date],'Fact Table'[StartDate],None)
)
RETURN
AVERAGEX(_Filtered_Fact_Table,[Score])
Output:
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
A business school provides education in business administration and management, offering programs like MBAs and specialized degrees to develop skills in finance, marketing, strategy, and leadership for professional advancement.
A medical school educates future doctors, offering rigorous training in medical science, clinical practice, and patient care, leading to an MD or DO degree, essential for a career in medicine.
A medical school educates future doctors, offering rigorous training in medical science, clinical practice, and patient care, leading to an MD or DO degree, essential for a career in medicine.
A medical school educates future doctors, offering rigorous training in medical science, clinical practice, and patient care, leading to an MD or DO degree, essential for a career in medicine.
Hi,
To achieve this, you can use a DAX measure in Power BI that calculates the average of the score column in your fact table, taking into account the date slicer that is based on the Date table and filtering between the startdate and enddate columns. Here’s a step-by-step guide on how to create this measure:
Ensure Relationships: Verify that your Date table is correctly related to your fact table through the startdate column.
Create the Measure: Use the following DAX code to create a measure that calculates the average score within the specified date range.
Feel free to ask on Yacine TV if you have any more questions or need further assistance!
Thank you!
To achieve this, you can create a measure in Power BI using DAX. First, create a measure for the average score in your fact table. Then, use the FILTER function to filter the fact table based on the selected date range from the slicer url using RELATED function to relate the date column in the fact table to the date column in the date table. Finally, calculate the average score within this filtered context. Your measure would look something like this:
This measure will dynamically calculate the average score based on the selected date range from the slicer.
Hello! It looks like you're looking to perform a filtering and averaging operation based on date segmentation. Here's a general approach you could take, assuming you're working with some query language or data manipulation like SQL.
Let's say you have two tables: DateTable, and FactsTable. Here's an example of how you might structure your query:
In this consultation:
Be sure to replace SelectedDate with the actual variable or value you get from the date slicer.
This is a general example and you may need to adjust the GB WhatsApp syntax depending on the database management system you're using and the exact structure of your tables. If you're using a different environment or if you have more details about your setup, it might provide a more specific answer. GB WhatsApp APK
Hi,
Based on that data that you have shared, show the expected result.
Hello
You can use the following SQL query to get the average of the fact column based on date targeting:
Here:
Adjust according to your specific DBMS and table structure. Install AN WhatsApp Now
sorry, there additional column name 'project' as below;
Example if project is A and date selection is May - 23 (within startdate 7 enddate) then 4, if project is A and date selection is Jan - 23(outside startdate & enddate) then Blank
Hi @Anonymous
Try this measure:
Avg. Score Selected Date =
Var _Max_Selected_Date = MAX('Date table'[Date])
Var _Filtered_Fact_Table =
CALCULATETABLE(
FILTER(
'Fact Table',
'Fact Table'[StartDate]<=_Max_Selected_Date&&'Fact Table'[EndDate]>=_Max_Selected_Date
),
CROSSFILTER('Date table'[Date],'Fact Table'[StartDate],None)
)
RETURN
AVERAGEX(_Filtered_Fact_Table,[Score])
Output:
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
105 | |
99 | |
99 | |
38 | |
37 |
User | Count |
---|---|
157 | |
120 | |
74 | |
72 | |
63 |