Created
June 25, 2020 05:04
-
-
Save maxim-uvarov/17ed50caa1f96e9fcad57f9335c96fdd to your computer and use it in GitHub Desktop.
pasha ver
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DEFINE | |
MEASURE factmetrica[s] = | |
SUM ( factmetrica[Клики] ) | |
EVALUATE | |
VAR _t0 = | |
SUMMARIZE ( | |
factmetrica, | |
FactMetrica[Поисковая фраза (Директ)] | |
) | |
VAR _t1 = | |
ADDCOLUMNS ( | |
_t0, | |
"idx", RANKX ( | |
_t0, | |
[s], | |
, | |
desc, | |
DENSE | |
), | |
"sum", [s] | |
) | |
VAR _t2 = | |
ADDCOLUMNS ( | |
_t1, | |
"pct_acc", | |
VAR _idx = [idx] | |
RETURN | |
SUMX ( | |
FILTER ( | |
_t1, | |
[idx] <= _idx | |
), | |
[sum] | |
) | |
/ CALCULATE ( | |
[s], | |
ALLSELECTED ( FactMetrica[Поисковая фраза (Директ)] ) | |
) | |
) | |
RETURN | |
NATURALLEFTOUTERJOIN ( | |
factmetrica, | |
_t2 | |
) | |
ORDER BY [Поисковая фраза (Директ)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment