Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello everyone,
I have a one-to-many relationship between the 'Main' table and the 'LastSixMonthCount' table on the column 'Classification'. The 'Main' table has all the customer reviews. Now I am trying to create a new column in the 'LastSixMonthCount' table, which calculates the counts of customer reviews for each classification in the last six months. My DAX is below, but it does not work. Does anyone have any ideas?
Solved! Go to Solution.
hi @kaikai24 ,
try like:
CountReview =
COUNTROWS(
FILTER(
RELATEDTABLE(main),
main[datelast] >= EDATE(TODAY(), -6)
)
)
Hey @kaikai24
Please try using this DAX:-
LastSixMonthReviewCount =
VAR SixMonthsAgo = TODAY() - 180
RETURN
CALCULATE(
COUNTROWS('Main'),
'Main'[Classification] = 'LastSixMonthCount'[Classification],
'Main'[ReviewDate] >= SixMonthsAgo
)
Please let me know if it works for you.
Regards,
Poojara.
Hi @kaikai24 ,
I create two tables as you mentioned and I also create a relationship between them.
Then I create a new calculated column and here is the DAX code.
CountReview =
CALCULATE (
COUNT ( 'Main'[DA ReviewId] ),
FILTER (
'Main',
AND (
'Main'[Classification] = EARLIER ( 'LastSixMonthCount'[Classification] ),
DATEDIFF ( 'Main'[Date of latest rating], TODAY (), MONTH ) <= 6
)
)
)
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
hi @kaikai24 ,
try like:
CountReview =
COUNTROWS(
FILTER(
RELATEDTABLE(main),
main[datelast] >= EDATE(TODAY(), -6)
)
)
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
9 | |
8 | |
8 |
User | Count |
---|---|
14 | |
12 | |
11 | |
11 | |
8 |