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
Arturo24
Frequent Visitor

Display remaining dates in the month with a zero value

Newbie here

The fact table has sales for 1-Jan through 15-Jul

The date table has date entries for the entire year

 

How do you return sales for each day from 1-Jan through 31-Jul where each day from 16-Jul through 31-Jul show a zero?  Don't want to go beyond 31-Jul.

 

Thank you

6 REPLIES 6
v-xiaoyan-msft
Community Support
Community Support

Hi @Arturo24 ,

 

Does the replies above solve your problem? If it has been solved, please mark the correct reply as the standard answer to help the other members find it more quickly.Thanks in advance for your kind cooperation!

 

Hope it helps,


Community Support Team _ Caitlyn

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

Arturo24
Frequent Visitor

I meant your solution looks much cleaner 😁

amitchandak
Super User
Super User

@Arturo24 , Hope you have selected Jul 2021 in Silcer

 

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))

 

 

Now I have an additional question on returning all dates:  The goal was to return ALL dates from first sales to the end of the current month, which we said was 31-Jul. 

 

Situation:
Salesperson A has sales in July , Salesperson B has sales in June.  If you filter by salesperson, for person A we see dates all the way through 31-Jul.  For person  we see sales up through 30-Jun. 

 

Question:

How can I keep the filter on the individual sales person but still return all dates until the end of the month, 31-Jul?  For whichever sales person I select how do I return the exact same (entire) date range?

 

I tried All() but it doesn't work.  

 

Thank you

Hi,

To your Table visual, drag Dates from the Calendar Table and write this measure

Total = sum(Data[Sales])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

I did something like below.  I used the IF statements in case there were dates between the two ranges where there were no sales.  Would also like to see those dates.  I think your variable _1 does that by adding zero to a blank entry.  Looks much cleaner.  Thanks. 

 

0 between Range Measure =
VAR CurrentDate = max( dDate[date] )
VAR EOM = EOMONTH(today (),0 )
VAR DateRange = CurrentDate >= min('Sales'[SaleDate]) && CurrentDate <= EOM
VAR Sales = if ( DateRange,
if ( isblank ( SUM ( Opportunity[Opportunity count] ) ) , 0 ,
                    SUM ( Opportunity[Opportunity count] ) )
)
Return
Sales

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.