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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
DataSciWannabe
Frequent Visitor

Measure Calculate Based Off Expression

Hello,

 

I was hoping to get help writing a formula that would calculate based off the results of another expresion.

 

The data looks like the below except 2MM+ rows

NameDateSalesQty
a12/1/201830010
b12/1/2018  
c12/1/201820012
d12/1/201850017
a1/1/20191005
b1/1/201960020
c1/1/201950014
d1/1/201990025

 

 

I have a measure that calculates the price (Sales/Qty) and then one that calculates the change in price based off of two slicers for a beginning and end date. If there is no data in either the beginning or the end month (see the b name 12/1/2018), there is no ability to return a price change, so it is marked as a blank.

 

I would like to be able to return the total of sales from the date 

 

I have the measure below which calculates the sales total for values being captures, I want to adjust it for an additional filter where the value of the Blank Measure = 1, but nothing I try seems to be working

 

Sales Measure

CALCULATE([Sales],DATESBETWEEN('Calendar'[Date],VALUES(Beg_Slicer[Beg. Date]),VALUES(End_Slicer[End Date])))

 

Blank Measure

sumx(values('data'[name]), if([Price_Chg] = "",1,0) )

 

thanks all

1 REPLY 1
Anonymous
Not applicable

Do you have Date/Calendar table? If so, is it marked as a Date Table in data view?  DATESBETWEEN is a time-intelligence function that requires a Calendar table to work correctly. If you dont have one, can make on pretty easily. But that would be initial step here I feel to troubleshoot your problem. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.