cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
KasireddyVeen
Frequent Visitor

Waterfall chart: Current quarter - Previous Quarter logic is not working

Hi,

 

I'm trying to create a waterfall chart that shows a Quarter in X-axis and the raise and fall of usage in the Yaxis,

first quarter should show the actual value of that quarter and from the next quarter onwards it should show the current - previous


Table I'm using = Sample

DateUsageSite IdSite NameY-QYQRank
22-Dec-228.6881A2022-Q41
20-Jan-238.0581A2023-Q12
20-Apr-235.5081A2023-Q23
20-Jul-23 81A2023-Q34
20-Oct-23 81A2023-Q45
22-Dec-2210.1982B2022-Q41
20-Jan-239.2682B2023-Q12
20-Apr-235.8382B2023-Q23
20-Jul-23 82B2023-Q34
20-Oct-23 82B2023-Q45
22-Dec-228.9483C2022-Q41
20-Jan-238.8983C2023-Q12
20-Apr-235.2783C2023-Q23
20-Jul-23 83C2023-Q34
20-Oct-23 83C2023-Q45

KasireddyVeen_0-1691310469535.png

 

The Dax measure which I'm using is working fine when I choose all site names, but it is not working fine when I choose a particular site (Ex: A) form the slicer.

Measure I'm currently using

Measure =
 VAR __Current = sum('Sample'[Usage])
  VAR __CurrentQR = MAX('Sample'[YQRank])
  VAR __Previous = SUMX(FILTER(ALL('Sample'),[YQRank] = __CurrentQR - 1), [Usage])
  VAR __Result = IF(__Current=BLANK(),"0",__Current - __Previous)
RETURN
__Result

 

Working fine when I choose all Site Names

KasireddyVeen_0-1691308663765.png  

When I select Only one site name for example 'A', It is giving wrong output as shown below.

KasireddyVeen_1-1691309075137.png

Expected Result

When I select only 'A' The values should be
2022-Q4 = 8.68
2023-Q1 = -0.63  ----> (8.05-8.68)
2023-Q2 = -2.55  ----> (5.50-8.05)


Can some one please help me on this. Thanks in Advnse.

 

1 ACCEPTED SOLUTION
Reddy5833
Helper I
Helper I

Hi Veena,

 

Try with below measure

 

Measure =
 VAR __Current = sum('Sample'[Usage])
VAR __Table = FILTER(ALLSELECTED('Sample'),'Sample'[Site Name] = "A") // since we are not using calculate function here, so first we need to filterout the table with required category and keep it in avariable
  VAR __CurrentQR = MAX('Sample'[YQRank])
  VAR __Previous = SUMX(FILTER(__Table,[YQRank] = __CurrentQR - 1), [Usage])
  VAR __Result = IF(__Current=BLANK(),"0",__Current - __Previous)
RETURN
__Result
 
To make it dynamic based on slicer selection (single/multiple/all ) use below measure
Measure 1 =
VAR __Site = VALUES('Sample'[Site Name])
 VAR __Current = sum('Sample'[Usage])
VAR __Table = FILTER(ALLSELECTED('Sample'),'Sample'[Site Name]in __Site) 
  VAR __CurrentQR = MAX('Sample'[YQRank])
  VAR __Previous = SUMX(FILTER(__Table,[YQRank] = __CurrentQR - 1), [Usage])
  VAR __Result = IF(__Current=BLANK(),"0",__Current - __Previous)
RETURN
__Result

View solution in original post

3 REPLIES 3
Reddy5833
Helper I
Helper I

Hi @KasireddyVeen,

 

 

Try with below measure

 

Measure =
 VAR __Current = sum('Sample'[Usage])
VAR __Table = FILTER(ALLSELECTED('Sample'),'Sample'[Site Name] = "A") // since we are not using calculate function here, so first we need to filterout the table with required category and keep it in avariable
  VAR __CurrentQR = MAX('Sample'[YQRank])
  VAR __Previous = SUMX(FILTER(__Table,[YQRank] = __CurrentQR - 1), [Usage])
  VAR __Result = IF(__Current=BLANK(),"0",__Current - __Previous)
RETURN
__Result
 
To make it dynamic based on slicer selection (single/multiple/all ) use below measure
Measure 1 =
VAR __Site = VALUES('Sample'[Site Name])
 VAR __Current = sum('Sample'[Usage])
VAR __Table = FILTER(ALLSELECTED('Sample'),'Sample'[Site Name]in __Site) 
  VAR __CurrentQR = MAX('Sample'[YQRank])
  VAR __Previous = SUMX(FILTER(__Table,[YQRank] = __CurrentQR - 1), [Usage])
  VAR __Result = IF(__Current=BLANK(),"0",__Current - __Previous)
RETURN
__Result
Reddy5833
Helper I
Helper I

Hi Veena,

 

Try with below measure

 

Measure =
 VAR __Current = sum('Sample'[Usage])
VAR __Table = FILTER(ALLSELECTED('Sample'),'Sample'[Site Name] = "A") // since we are not using calculate function here, so first we need to filterout the table with required category and keep it in avariable
  VAR __CurrentQR = MAX('Sample'[YQRank])
  VAR __Previous = SUMX(FILTER(__Table,[YQRank] = __CurrentQR - 1), [Usage])
  VAR __Result = IF(__Current=BLANK(),"0",__Current - __Previous)
RETURN
__Result
 
To make it dynamic based on slicer selection (single/multiple/all ) use below measure
Measure 1 =
VAR __Site = VALUES('Sample'[Site Name])
 VAR __Current = sum('Sample'[Usage])
VAR __Table = FILTER(ALLSELECTED('Sample'),'Sample'[Site Name]in __Site) 
  VAR __CurrentQR = MAX('Sample'[YQRank])
  VAR __Previous = SUMX(FILTER(__Table,[YQRank] = __CurrentQR - 1), [Usage])
  VAR __Result = IF(__Current=BLANK(),"0",__Current - __Previous)
RETURN
__Result

Hi,

 

Thanks for the reply, it is working as expected. that was a great help.

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors