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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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 II
Helper II

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 II
Helper II

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 II
Helper II

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.