Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I am trying to visualise the number of profitable days vs non profitable days per month. To this, I want to add an adjusteable measure to what defines a profitable day. Please see the screenshot:
I would like to be able to change the value of the measure using a slicer to change the definition of what counts as a profitable day (e.g. if I want to set the limit at 500). However, it seems like it is not possible to use a slicer for a measure. It would be highly appreciated to receive some assistance in this. Thanks!
Solved! Go to Solution.
Hi,
I think you are looking for this:
_NumberOfNotProfitableDays = SUMX(SUMMARIZE(tblSales,[_Day], "C", IF(SUM(tblSales[sales_amount]) <= Threshold_profitableday[Threshold_profitableday Value],1,BLANK())),[C])
_NumberOfProfitableDays = SUMX(SUMMARIZE(tblSales,[_Day], "C", IF(SUM(tblSales[sales_amount]) > Threshold_profitableday[Threshold_profitableday Value],1,BLANK())),[C])
_Day = DAY(tblSales[sales_date_time])
As seen here:
Link to file.
Please mark as solution if so. Thumbs up for the effort are appreciated.
Kind regards,
Steve.
Testdata generated with:
tblSales =
var _tbl =
SELECTCOLUMNS(
CROSSJOIN(
ROW("test", DATE(2020, 10,3)),
GENERATESERIES(1,60,1)
), "StartDate", [test], "Increment", [Value])
var _dates =
ADDCOLUMNS( _tbl, "NewDate", [StartDate]+[Increment])
return
SELECTCOLUMNS(
ADDCOLUMNS(
CROSSJOIN(
_dates, GENERATESERIES(1,10,1)), "open_time", [NewDate] + NORM.INV(RAND(), 0.5 + ([Increment]/100), 0.08), "sales_ref", CONVERT( UNICHAR(RANDBETWEEN(65,90)),STRING) & CONVERT( UNICHAR(RANDBETWEEN(65,90)),STRING) & CONVERT( UNICHAR(RANDBETWEEN(65,90)),STRING), "sales_amount", NORM.INV(RAND(), [Value], [Value]/10)
), "sales_date_time", [open_time], "sales_ref", [sales_ref], "sales_amount", [sales_amount])
Proud to be a Super User!
Awesome Keyboard Shortcusts in Power BI, thumbs up if you like the article
My Community Blog Articles (check them out!)
My Blog - Power M code to automatically detect column types -
How to create test data using DAX!
Hi,
I think you are looking for this:
_NumberOfNotProfitableDays = SUMX(SUMMARIZE(tblSales,[_Day], "C", IF(SUM(tblSales[sales_amount]) <= Threshold_profitableday[Threshold_profitableday Value],1,BLANK())),[C])
_NumberOfProfitableDays = SUMX(SUMMARIZE(tblSales,[_Day], "C", IF(SUM(tblSales[sales_amount]) > Threshold_profitableday[Threshold_profitableday Value],1,BLANK())),[C])
_Day = DAY(tblSales[sales_date_time])
As seen here:
Link to file.
Please mark as solution if so. Thumbs up for the effort are appreciated.
Kind regards,
Steve.
Testdata generated with:
tblSales =
var _tbl =
SELECTCOLUMNS(
CROSSJOIN(
ROW("test", DATE(2020, 10,3)),
GENERATESERIES(1,60,1)
), "StartDate", [test], "Increment", [Value])
var _dates =
ADDCOLUMNS( _tbl, "NewDate", [StartDate]+[Increment])
return
SELECTCOLUMNS(
ADDCOLUMNS(
CROSSJOIN(
_dates, GENERATESERIES(1,10,1)), "open_time", [NewDate] + NORM.INV(RAND(), 0.5 + ([Increment]/100), 0.08), "sales_ref", CONVERT( UNICHAR(RANDBETWEEN(65,90)),STRING) & CONVERT( UNICHAR(RANDBETWEEN(65,90)),STRING) & CONVERT( UNICHAR(RANDBETWEEN(65,90)),STRING), "sales_amount", NORM.INV(RAND(), [Value], [Value]/10)
), "sales_date_time", [open_time], "sales_ref", [sales_ref], "sales_amount", [sales_amount])
Proud to be a Super User!
Awesome Keyboard Shortcusts in Power BI, thumbs up if you like the article
My Community Blog Articles (check them out!)
My Blog - Power M code to automatically detect column types -
How to create test data using DAX!
Thank you, that was awesome! 🙂
Im really really new to Power BI, please be kind 😛
Do you know any other solution to this?
To harvest values from slicers you can use the SELECTEDVALUE function and use it in a measure. Please refer to this: https://dax.guide/selectedvalue/
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
23 | |
7 | |
7 | |
6 | |
6 |
User | Count |
---|---|
27 | |
12 | |
10 | |
9 | |
6 |