Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Dear Community,
I allow myself to post here because it has been 2 days i'm trying to find how to fix my issue but I'm getting nuts.
In a nutshell, I would like to create a measure that calculates the sum of the "Estimated Sales" for all business opportunities (in the 'tbl_opportunities' table) and to to show the sum for all the opportunities in the matrix only if the current date ( tbl_Date[Date] ) is included between the creation date ( tbl_opportunity[Created On] ) and the closing date ( tbl_opportunity[Closing Date] )of each opportunity.
I have tried the following formula but still, the opportunities show off after the tbl_opportunity[Closing Date]:
Open Opportunity =
VAR DateMax =
MAX ( tbl_date[Date] )
RETURN
SUMX (
tbl_opportunity,
VAR Result =
CALCULATE ( SUM ( tbl_opportunity[Estimated value] ), ALL ( tbl_date ) )
RETURN
IF (
DateMax >= tbl_opportunity[Created On]
&& DateMax <= tbl_opportunity[Closing Date],
Result
)
)
My aim would be to get a table that looks like this:
and here is a look of the 2 tables involved:
Any help is mora than welcome.
Many thanks in advance folk!
Solved! Go to Solution.
Hi , @Hipnobe
According to your description, you want to "How to disclose a sum only when the filter context is included between 2 dates".
For your need , you do not need to create any relationship between your table and your date table.
This is my test data:
We can create a measure like this:
Measure = var _created_date =YEAR( MAX('tbl_opportunity'[Created On])) *100 +MONTH( MAX('tbl_opportunity'[Created On]))
var _close_date =YEAR( MAX('tbl_opportunity'[Closing Date])) *100 +MONTH( MAX('tbl_opportunity'[Closing Date]))
var _value = SUM('tbl_opportunity'[Estimated value])
var _cur_date =YEAR( MIN('tbl_date'[Date])) *100 +MONTH( MIN('tbl_date'[Date]))
return
IF(_close_date>= _cur_date && _created_date<= _cur_date ,_value ,BLANK())
Then we can put this measure on the visual and we can meet your need:
If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi , @Hipnobe
According to your description, you want to "How to disclose a sum only when the filter context is included between 2 dates".
For your need , you do not need to create any relationship between your table and your date table.
This is my test data:
We can create a measure like this:
Measure = var _created_date =YEAR( MAX('tbl_opportunity'[Created On])) *100 +MONTH( MAX('tbl_opportunity'[Created On]))
var _close_date =YEAR( MAX('tbl_opportunity'[Closing Date])) *100 +MONTH( MAX('tbl_opportunity'[Closing Date]))
var _value = SUM('tbl_opportunity'[Estimated value])
var _cur_date =YEAR( MIN('tbl_date'[Date])) *100 +MONTH( MIN('tbl_date'[Date]))
return
IF(_close_date>= _cur_date && _created_date<= _cur_date ,_value ,BLANK())
Then we can put this measure on the visual and we can meet your need:
If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
User | Count |
---|---|
12 | |
12 | |
8 | |
8 | |
6 |
User | Count |
---|---|
27 | |
19 | |
13 | |
11 | |
7 |