The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I have a matrix that show sales amount and anothers sales details by date.
For the features of the report, I have 2 slicers. One with the month of the year and another with the range of dates.
I created a measure that estimate the sales amount in a selected range of dates (using the slicer of range of dates), but I have a problem when i selecting a particular month (in month of the year' slicer) the measure of sales amount ignored the range of dates selected (in the slicer of range of dates) and takes only the range between the first and last date in month selected.
How can I resolved this problem?
This is my code:
This is my code:
sales_range =
VAR _minDate = MINX(ALLSELECTED(dates[date]), dates[date])
VAR _maxDate = MAXX(ALLSELECTED(dates[date]), dates[date])
VAR sales_range =
CALCULATE(
SUMX(sales_table,sales_table[total_sale]),
DATESBETWEEN(
dates[date],
_minDate,
_maxDate
)
)
RETURN
sales_range
Hi @jmorav291 ,
Based on my test , you can edit the interactions between the month of the year slicer and the visual you want to show [sales_range]. In my sample, I edit the interactions between months slicer and card visual to none, the measure in card visual will only be effected date range slicer.
For more details, please refer to the sample pbix file: https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/EW6you385DpOmhI6cd...
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
@jmorav291 , it seems your measure equally functions as this in a standard dates 1:* sales_table model.
sales_range = CALCULATE ( SUM ( sales_table[total_sale] ), dates )
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |