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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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