0

I am working in a project with power BI and DAX but it seems not working right for me.

I have a first table vproject that contains multiple projects and each one have multiple tasks with multiple levels and I want to get each task the amount cost.

My measures work like the summarize of each level cost equal the sum of the budget. But when I want to aggregate the name of the task the budget doesn't summarize correctly. In this pic a demonstration of my input and my output :

projet| tache niv1| budget tache niv1|  tache niv2| budget tache niv2|  tache niv3|  budget tache niv3|     budget total
:1| a|      50|         b|      25|         c|       25|                300 $: 
:1| a|      50|         a|      50:          |         |:
:1| a|      30|         a|      20|         a|       50|:       
:2| a|      20|         x|      65|         y|       15|                200 $ :
:2| g|      15|         g|      25|         g|       60|    :   

And here are my measures and my query:

Budget_niv1= [Budget prévu ]*SELECTEDVALUE(vProject[PourcentageRépartitionniveau1])
Budget_niv2= [Budget prévu ]*SELECTEDVALUE(vProject[PourcentageRépartitionniveau2])
Budget_niv3= [Budget prévu ]*SELECTEDVALUE(vProject[PourcentageRépartitionniveau3])

Query for the new table :

Budget level = 
var Year = SELECTEDVALUE(vTime[fYear])
VAR CombineTable =
UNION(
        SELECTCOLUMNS(vProject, "niveau", vProject[Répartitionniveau1], "Budget", [Budget_niv1]),
        SELECTCOLUMNS(vProject, "niveau", vProject[Répartitionniveau2], "Budget", [Budget_niv2]),
        SELECTCOLUMNS(vProject, "niveau", vProject[Répartitionniveau3], "Budget", [Budget_niv3])
    )
VAR Resultat = 
    SUMMARIZE(
        CombineTable,
        [niveau],
        "Budget Total", 
    SUMX(
        FILTER(CombineTable, [niveau] = EARLIER([niveau])),
        [Budget]))
   
RETURN
Resultat
1
  • what's the expected output based on the sample data you provided? Commented Aug 18 at 1:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.