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,
I am trying to create a measure that will replace a particular sales order for a particular day (aggregated to a group number) with a sales amount of a different day. The model contains a fact table and the helper table which contains a group number, bad date, and good date. The group number carries the relationship (1 to *).
For example: I wish to aggregate all the sales by Group number "A12" and then replace A12's total sales from May 1st with the total sales from April 24th.
I have been trying to utilize
Hi @Anonymous ,
How about the result after you follow the suggestions mentioned in my original post?Could you please provide more details about it If it doesn't meet your requirement?
Best regards,
Hi @Anonymous ,
We can try to use the following measure to meet your requirement:
Measure =
var t = ALLSELECTED(Sales)
return
SUMX (
DISTINCT ( 'Sales'[AS_OF_DATE] ),
VAR currentDate = 'Sales'[AS_OF_DATE]
RETURN
CALCULATE (
SUM ( 'Sales'[Sales_Amount] ),
FILTER (
t,
VAR BadDate =
CALCULATETABLE (
DISTINCT ( 'ReplaceDateTable'[bad date] ),
RELATEDTABLE ( ReplaceDateTable )
)
VAR GoodDate =
CALCULATETABLE (
DISTINCT ( 'ReplaceDateTable'[good date] ),
RELATEDTABLE ( ReplaceDateTable )
)
RETURN
IF (
'Sales'[AS_OF_DATE] IN GoodDate
&& currentDate IN BadDate
|| ( NOT ( currentDate IN BadDate )
&& currentDate = 'Sales'[AS_OF_DATE] ),
TRUE (),
FALSE ()
)
)
)
)
If it doesn't meet your requirement, Could you please show the exact expected result based on the tables that we have shared?
By the way, PBIX file as attached.
Best regards,
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 |
---|---|
69 | |
60 | |
51 | |
36 | |
36 |
User | Count |
---|---|
84 | |
70 | |
58 | |
45 | |
44 |