Partition By not working to show correct SM% when I change parameters view options

Deal All, I have prepared a P&L summary with below aspect
When I change the filter in the "Geography/Product View" and for example I switch from "P&L" to "Geography", I am not able tom show the proper SM% by Geography, I see the same % for the different countries in the same quarter, see below
As Column I am showing the Fiscal Quarter and I am using below specific formula to calculate the SM %:
WHEN P&L Account name
='SM Act%' THEN
CASE WHEN SUM(SUM(CASE WHEN P&L Account name
='SM Act' THEN SM Act
ELSE 0 END)) OVER (PARTITION BY FISCL_QTR
,'Geo/Prod view 1','Geo/Prod view 2','Geo/Prod view 3','Geo/Prod view 4')/SUM(SUM(CASE WHEN P&L Account name
='Sales Act' THEN Sales Act
ELSE 0 END)) OVER (PARTITION BY FISCL_QTR
,'Geo/Prod view 1','Geo/Prod view 2','Geo/Prod view 3','Geo/Prod view 4') >=0 THEN
CONCAT( ROUND(SUM(SUM(CASE WHEN P&L Account name
='SM Act' THEN SM Act
ELSE 0 END)) OVER (PARTITION BY FISCL_QTR
,'Geo/Prod view 1','Geo/Prod view 2','Geo/Prod view 3','Geo/Prod view 4')/SUM(SUM(CASE WHEN P&L Account name
='Sales Act' THEN Sales Act
ELSE 0 END)) OVER (PARTITION BY FISCL_QTR
,'Geo/Prod view 1','Geo/Prod view 2','Geo/Prod view 3','Geo/Prod view 4')*100,1),'%')
ELSE
CONCAT('(', ROUND(SUM(SUM(CASE WHEN P&L Account name
='SM Act' THEN SM Act
ELSE 0 END)) OVER (PARTITION BY FISCL_QTR
,'Geo/Prod view 1','Geo/Prod view 2','Geo/Prod view 3','Geo/Prod view 4')/SUM(SUM(CASE WHEN P&L Account name
='Sales Act' THEN Sales Act
ELSE 0 END)) OVER (PARTITION BY FISCL_QTR
,'Geo/Prod view 1','Geo/Prod view 2','Geo/Prod view 3','Geo/Prod view 4')*100,1),'%)') END
In Dataset I have :
one column called "P&L Account Name" with the P&L parameters: Sales Act, SM Act, SM%
one column called "Sales Act" to show values for Sales
one column called "SM Act" to show values for Sales Margin
On top, I created below variable to choose different option view
The issue is with the Partition By parameters, below parameters are not working in the Beast Mode:
(PARTITION BY FISCL_QTR
,'Geo/Prod view 1','Geo/Prod view 2','Geo/Prod view 3','Geo/Prod view 4')
where "Fiscl_QTR" is the quarter
where "Geo/Prod view 1" is:
Case
when Geography/Product View
= 'Geography' then P&L Account name
when Geography/Product View
= 'Product' then P&L Account name
when Geography/Product View
= 'P&L' then P&L Account name
END
where "Geo/Prod view 2" is:
Case
when Geography/Product View
= 'Geography' then Zone
when Geography/Product View
= 'Product' then Business
END
where "Geo/Prod view 3" is:
Case
when Geography/Product View
= 'Geography' then LCT
when Geography/Product View
= 'Product' then Sub Mod 2
END
where "Geo/Prod view 4" is:
Case
when Geography/Product View
= 'Geography' then Country
when Geography/Product View
= 'Product' then Sub Mod 1
END
Could you please help me to fix the Partiton parameters or do you suggest some other alternatives in order to show correct SM% for each country and each quarter?
Regards
Luca
Answers
-
Your case statements don't have any clause for when Geography/Product View = 'P&L'
Either add an else 1 at then end of each case statement, or call out a specific value for each option that the user can select.
“There is a superhero in all of us, we just need the courage to put on the cape.” -Superman2 -
Hi ST Superman, so if I understood correctly as first option you are suggesting to modify my formula like below
where "Geo/Prod view 1" is:
Case
when
Geography/Product View
= 'Geography' thenP&L Account name
whenGeography/Product View
= 'Product' thenP&L Account name
whenGeography/Product View
= 'P&L' thenP&L Account name
ELSE 1
ENDGeo/Prod view 2" is:
Case
when
Geography/Product View
= 'Geography' thenZone
whenGeography/Product View
= 'Product' thenBusiness
ELSE 1
END
etc
I didn't understand second option "or call out a specific value for each option that the user can select."
coul you show me an example modifying my formula?
Thx a lot for your help!!!!
Luca
0 -
I tried the suggested solutiion, adding the ELSE 1, but unfortunately the SM% is not working, it is still showing same %. The is is whith PARTTION BY, do you know some way to fix PARTITION BY issue?
0
Categories
- 10.5K All Categories
- 3 Connect
- 913 Connectors
- 250 Workbench
- 458 Transform
- 1.7K Magic ETL
- 69 SQL DataFlows
- 476 Datasets
- 183 Visualize
- 249 Beast Mode
- 2.1K Charting
- 11 Variables
- 16 Automate
- 354 APIs & Domo Developer
- 88 Apps
- 3 Workflows
- 20 Predict
- 5 Jupyter Workspaces
- 15 R & Python Tiles
- 245 Distribute
- 62 Domo Everywhere
- 242 Scheduled Reports
- 20 Manage
- 41 Governance & Security
- 168 Product Ideas
- 1.2K Ideas Exchange
- 9 Community Forums
- 27 Getting Started
- 14 Community Member Introductions
- 55 Community News
- 4.5K Archive