Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
PVO2
Frequent Visitor

Forcing zero's to specific period / Customer scenario

Hi,

 

I'm looking for some help regarding forcing zero's.

 

Measure below is working correcty, but I would like to show zero's instead of blanks in the following scenario's:

- Customer has [Sales] withing scope period

- Only show zero's  within the scope period.

Cannot use calculated columns / PowerQuery.

 

Test =
VAR _start = DATE(2021,9,1)
VAR _scope = DATESBETWEEN('Calendar'[Date], _start, TODAY())
RETURN
CALCULATE([Sales], _scope)

 

 

Current result:

 Year 2021 
Customer/SalesAugustSeptemberOktoberTotals
ABLANKBLANK1010
BBLANKBLANKBLANKBLANK
CBLANK30BLANK30
DBLANK102030
EBLANKBLANKBLANKBLANK
TotalsBLANK403070

 

Desired result:

 Year 2021 
Customer/SalesAugustSeptemberOktoberTotals
ABLANK01010
BBLANKBLANKBLANKBLANK
CBLANK30030
DBLANK102030
EBLANKBLANKBLANKBLANK
TotalsBLANK403070

 

Hope anyone is able to help me. Already tried a lot of ALL, REMOVEFILTERS, FILTER, ALLEXEPT, etc.

2 REPLIES 2
PVO2
Frequent Visitor

Thanks for your reply. Unfortunatly your suggestion only takes the 'Calender' into consideration, not the 'Customer'.

So I need a double range solution which takes DATESBETWEEN into consideration.

 

So, if the customer has any value in the given period, all dates in given period should get 0 instead of blank.

amitchandak
Super User
Super User

@PVO2 , Please find example measure for +0 for a selected range 

 

0 between range
Measure = var _1= SUM(Opportunity[Opportunity count]) +0
var _min = minx(ALLSELECTED('Calendar'), 'Calendar'[Date])
var _max = maxx(ALLSELECTED('Calendar'), 'Calendar'[Date])
return
CALCULATE(if(max('Calendar'[Date]) <_min || max('Calendar'[Date]) >_max , BLANK(), _1))

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.