Calculate a date according slicers chosen
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I need your help on PowerBI. I'd like to calculate something according to the slicers chosen by the user. I read that what I wanted to do at first is impossible (I wanted to add a calculated column according to the slicers chosen by the user) but maybe you will find me another way to succeed. Let me explain.
I have 2 tables, not related.
Table 1 will be used to add 3 slicers: slicer Category, slicer Type, slicer Rp.
Category Type Rp
c1 A X
c1 B X
c2 C X
c2 D Y
Table 2 will contain my data (my dates are formatted in dd/mm/yyyy).
ID TheoreticalDeadline RealDeadline Done Type _A Type _B Type _C Type _D
Abc 01/05/2018 02/05/2018 Y 5 0 0 3
Def 05/04/2018 05/04/2018 Y 0 0 2 0
Ghi 12/03/2018 18/03/2018 N 0 0 0 1
I have made the following measures (which works fine):
Done_Where = if(Table2[Done]="Y"; 1; 0)
DoneGood_Where=if(Table2[Done]="Y";
if(Table2[RealDeadline]<=Table2[TheoreticalDeadline]; 1; 0))
Result1 = SUM(Table2[DoneGood_Where])/sum(Table2[Done_Where])
In my example, Result1 = 1 /2 because:
DefhasRealDeadlineequal thanTheoreticalDeadline
GhihasDone = Nso is not taken into account
I want to make a Result2 which will depend on the user choices.
Result2 = SUM(Table2[DoneGood_WhereSelected])/sum(Table2[Done_Where])
And the problem is to compute DoneGood_WhereSelected. I would like something like this:
DoneGood_WhereSelected =
if(Table2[Done]="Y"; if(Table2[RealDeadline]<=Table2[TheoreticalDeadline] +
values from Table2 stored in the columns for which the user has clicked;1;0))
For instance, if the user click on the slicer Resp=X, then:
- For
Abc:TheoreticalDeadline + 5(becauseType_Abelongs toX) = 06/05/2018 - For
Def:TheoreticalDeadline + 2(becauseType_Cbelongs toX) = 07/04/2018
And then Result2 = 2/2 because:
AbcandDefhaveRealDeadline<TheoreticalDeadline+ values stored
In my example, the user clicks only on one checkbox of one slicer, but in reality, I'd like to authorize him to make multiple selections on the different slicers (example: the user click Rp=X and (Type=A or Type=B). In real life, I have 15 Types, 5 categories, and 2 Rp, so it's not optimized to compute every possible combination when loading data.
So, what kind of formulas could I use?
powerbi dax
add a comment |
I need your help on PowerBI. I'd like to calculate something according to the slicers chosen by the user. I read that what I wanted to do at first is impossible (I wanted to add a calculated column according to the slicers chosen by the user) but maybe you will find me another way to succeed. Let me explain.
I have 2 tables, not related.
Table 1 will be used to add 3 slicers: slicer Category, slicer Type, slicer Rp.
Category Type Rp
c1 A X
c1 B X
c2 C X
c2 D Y
Table 2 will contain my data (my dates are formatted in dd/mm/yyyy).
ID TheoreticalDeadline RealDeadline Done Type _A Type _B Type _C Type _D
Abc 01/05/2018 02/05/2018 Y 5 0 0 3
Def 05/04/2018 05/04/2018 Y 0 0 2 0
Ghi 12/03/2018 18/03/2018 N 0 0 0 1
I have made the following measures (which works fine):
Done_Where = if(Table2[Done]="Y"; 1; 0)
DoneGood_Where=if(Table2[Done]="Y";
if(Table2[RealDeadline]<=Table2[TheoreticalDeadline]; 1; 0))
Result1 = SUM(Table2[DoneGood_Where])/sum(Table2[Done_Where])
In my example, Result1 = 1 /2 because:
DefhasRealDeadlineequal thanTheoreticalDeadline
GhihasDone = Nso is not taken into account
I want to make a Result2 which will depend on the user choices.
Result2 = SUM(Table2[DoneGood_WhereSelected])/sum(Table2[Done_Where])
And the problem is to compute DoneGood_WhereSelected. I would like something like this:
DoneGood_WhereSelected =
if(Table2[Done]="Y"; if(Table2[RealDeadline]<=Table2[TheoreticalDeadline] +
values from Table2 stored in the columns for which the user has clicked;1;0))
For instance, if the user click on the slicer Resp=X, then:
- For
Abc:TheoreticalDeadline + 5(becauseType_Abelongs toX) = 06/05/2018 - For
Def:TheoreticalDeadline + 2(becauseType_Cbelongs toX) = 07/04/2018
And then Result2 = 2/2 because:
AbcandDefhaveRealDeadline<TheoreticalDeadline+ values stored
In my example, the user clicks only on one checkbox of one slicer, but in reality, I'd like to authorize him to make multiple selections on the different slicers (example: the user click Rp=X and (Type=A or Type=B). In real life, I have 15 Types, 5 categories, and 2 Rp, so it's not optimized to compute every possible combination when loading data.
So, what kind of formulas could I use?
powerbi dax
add a comment |
I need your help on PowerBI. I'd like to calculate something according to the slicers chosen by the user. I read that what I wanted to do at first is impossible (I wanted to add a calculated column according to the slicers chosen by the user) but maybe you will find me another way to succeed. Let me explain.
I have 2 tables, not related.
Table 1 will be used to add 3 slicers: slicer Category, slicer Type, slicer Rp.
Category Type Rp
c1 A X
c1 B X
c2 C X
c2 D Y
Table 2 will contain my data (my dates are formatted in dd/mm/yyyy).
ID TheoreticalDeadline RealDeadline Done Type _A Type _B Type _C Type _D
Abc 01/05/2018 02/05/2018 Y 5 0 0 3
Def 05/04/2018 05/04/2018 Y 0 0 2 0
Ghi 12/03/2018 18/03/2018 N 0 0 0 1
I have made the following measures (which works fine):
Done_Where = if(Table2[Done]="Y"; 1; 0)
DoneGood_Where=if(Table2[Done]="Y";
if(Table2[RealDeadline]<=Table2[TheoreticalDeadline]; 1; 0))
Result1 = SUM(Table2[DoneGood_Where])/sum(Table2[Done_Where])
In my example, Result1 = 1 /2 because:
DefhasRealDeadlineequal thanTheoreticalDeadline
GhihasDone = Nso is not taken into account
I want to make a Result2 which will depend on the user choices.
Result2 = SUM(Table2[DoneGood_WhereSelected])/sum(Table2[Done_Where])
And the problem is to compute DoneGood_WhereSelected. I would like something like this:
DoneGood_WhereSelected =
if(Table2[Done]="Y"; if(Table2[RealDeadline]<=Table2[TheoreticalDeadline] +
values from Table2 stored in the columns for which the user has clicked;1;0))
For instance, if the user click on the slicer Resp=X, then:
- For
Abc:TheoreticalDeadline + 5(becauseType_Abelongs toX) = 06/05/2018 - For
Def:TheoreticalDeadline + 2(becauseType_Cbelongs toX) = 07/04/2018
And then Result2 = 2/2 because:
AbcandDefhaveRealDeadline<TheoreticalDeadline+ values stored
In my example, the user clicks only on one checkbox of one slicer, but in reality, I'd like to authorize him to make multiple selections on the different slicers (example: the user click Rp=X and (Type=A or Type=B). In real life, I have 15 Types, 5 categories, and 2 Rp, so it's not optimized to compute every possible combination when loading data.
So, what kind of formulas could I use?
powerbi dax
I need your help on PowerBI. I'd like to calculate something according to the slicers chosen by the user. I read that what I wanted to do at first is impossible (I wanted to add a calculated column according to the slicers chosen by the user) but maybe you will find me another way to succeed. Let me explain.
I have 2 tables, not related.
Table 1 will be used to add 3 slicers: slicer Category, slicer Type, slicer Rp.
Category Type Rp
c1 A X
c1 B X
c2 C X
c2 D Y
Table 2 will contain my data (my dates are formatted in dd/mm/yyyy).
ID TheoreticalDeadline RealDeadline Done Type _A Type _B Type _C Type _D
Abc 01/05/2018 02/05/2018 Y 5 0 0 3
Def 05/04/2018 05/04/2018 Y 0 0 2 0
Ghi 12/03/2018 18/03/2018 N 0 0 0 1
I have made the following measures (which works fine):
Done_Where = if(Table2[Done]="Y"; 1; 0)
DoneGood_Where=if(Table2[Done]="Y";
if(Table2[RealDeadline]<=Table2[TheoreticalDeadline]; 1; 0))
Result1 = SUM(Table2[DoneGood_Where])/sum(Table2[Done_Where])
In my example, Result1 = 1 /2 because:
DefhasRealDeadlineequal thanTheoreticalDeadline
GhihasDone = Nso is not taken into account
I want to make a Result2 which will depend on the user choices.
Result2 = SUM(Table2[DoneGood_WhereSelected])/sum(Table2[Done_Where])
And the problem is to compute DoneGood_WhereSelected. I would like something like this:
DoneGood_WhereSelected =
if(Table2[Done]="Y"; if(Table2[RealDeadline]<=Table2[TheoreticalDeadline] +
values from Table2 stored in the columns for which the user has clicked;1;0))
For instance, if the user click on the slicer Resp=X, then:
- For
Abc:TheoreticalDeadline + 5(becauseType_Abelongs toX) = 06/05/2018 - For
Def:TheoreticalDeadline + 2(becauseType_Cbelongs toX) = 07/04/2018
And then Result2 = 2/2 because:
AbcandDefhaveRealDeadline<TheoreticalDeadline+ values stored
In my example, the user clicks only on one checkbox of one slicer, but in reality, I'd like to authorize him to make multiple selections on the different slicers (example: the user click Rp=X and (Type=A or Type=B). In real life, I have 15 Types, 5 categories, and 2 Rp, so it's not optimized to compute every possible combination when loading data.
So, what kind of formulas could I use?
powerbi dax
powerbi dax
edited Nov 16 '18 at 17:18
Alexis Olson
15.4k22136
15.4k22136
asked Nov 16 '18 at 14:20
mdlmmdlm
11
11
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53339652%2fcalculate-a-date-according-slicers-chosen%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53339652%2fcalculate-a-date-according-slicers-chosen%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown