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 need you help, I've been trying to solve this problem for several days and still don't know what to do.
I have a contract with 2 rows in my fact table, the first line is when the contract beginns and the second line is the extension. Both have the same price of 17,99Euro. According to bussiness definition , if I filter on 2019, I need to get the price 17,99 once in total, because the price should be considered only once in one year (2019).
And if I do not filter, then I should get the sume of those, since I'm querying the entire period. In this case, my measure works. Has anyone faced this problem, or has idea how to solve this with dax ?
Here is my measure :
Thanks,
Xuan
Solved! Go to Solution.
I solved that problem by using summarize:)
Hi @KXuan ,
Do you want to filter the table when year is selected in slicer? For example, when user selects 2019, the first row will be filtered.
Please modify your original Dax expression as following.
Measure =
var minyear= MIN('(F) Contract' [Beigin])
var maxyear= MAX('(F) Contract' [End])
RETURN
IF(SELECTEDVALUE(Table2[Year]) <> BLANK() , IF(SELECTEDVALUE(Table2[Year]) > YEAR(minyear) && SELECTEDVALUE(Table2[Year]) <= YEAR(maxyear) , 1 , 0) , 3)
Then set Filter as following.
Here is my test for your reference.
Best regards,
Mengmeng Li
Hello Mengmeng ,
Unfortunately, it's not what I want :(. Actually ,I just want to have the correct total without filtering in the table as in you example.
The idea of this measure is to get the price of contract which is valid in selected period ( so I think _maxyear und _minyear should be based on seperate date dimension instead ). In this example, it's 17,99 for 2019 or 2020 and 35,98 for the entire period.
Hope, that I explaned it well 😞
Best,
Xuan
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 |