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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
OlafA69
Frequent Visitor

Conditional Index

OlafA69_3-1658244688352.png

Dear all,

I'm happy to be a new user in this forum. I face an issue and I couldn't found a solution for this problem yet. I have the following problem. I want to create a Burn-Down Chart based on the Planned and the Actual columns. In column C, I add a simple Index which I sort in a descending order afterwards. But in column D2, I want to start with the same number as in column C2 and count down the number only when the State is set to 'Closed'. If it is not set to 'Closed' then the value should be taken from the previous cell. I have found a similar solution in this forum but not in combination with the index values in column C. I would be happy if you could give me a hint to get this problem solved. Thank you very much in advance for your support.

Thanks

Olaf

 

 

 

 

 

 

 

 

 

 

2 ACCEPTED SOLUTIONS
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

 

Untitled.png

 

Actual CC =
VAR _startdate =
    MIN ( Data[Date] )
VAR _startnumber =
    MAX ( Data[Planned] )
VAR _conditiontable =
    ADDCOLUMNS ( Data, "@condition", IF ( Data[State] = "Closed", -1 ) )
VAR _cumulatecondition =
    SUMX (
        FILTER ( _conditiontable, Data[Date] <= EARLIER ( Data[Date] ) ),
        [@condition]
    )
RETURN
    _startnumber + _cumulatecondition

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

SpartaBI
Community Champion
Community Champion

@OlafA69 this is another alternative, but @Jihwan_Kim solution is also great.

 

 

Actual CC = 
VAR _startnumber =
    MAX ( Data[Planned] )
VAR _minus_count =
    COUNTROWS(
        FILTER(
            Data, 
            Data[Planned] >= EARLIER(Data[Planned]) && Data[State] = "Closed")
    )
VAR _result = _startnumber - _minus_count
RETURN
    _result

 

 

SpartaBI_0-1658253646763.png

 




2022-05-19 17_30_22-Re_ Need help on DAX function with measure vs colu... - Microsoft Power BI Commu.png


Full-Logo11.png

SpartaBI_3-1652115470761.png   SpartaBI_1-1652115142093.png   SpartaBI_2-1652115154505.png

Showcase Report – Contoso By SpartaBI

View solution in original post

5 REPLIES 5
OlafA69
Frequent Visitor

Hello Forum,

in my first post I got great support from Jihwan_Kim and SparteBI. This time I would like to add two more filters. So this time I would like to count down the number in column D when the state is both "Closed" or "Done" or "Cancelled". I tried to solve it with an OR condition but it didn't work out. Any help is appreciated.

Thanks

Olaf

 

OlafA69_0-1658417133551.png

 

SpartaBI
Community Champion
Community Champion

@OlafA69 this is another alternative, but @Jihwan_Kim solution is also great.

 

 

Actual CC = 
VAR _startnumber =
    MAX ( Data[Planned] )
VAR _minus_count =
    COUNTROWS(
        FILTER(
            Data, 
            Data[Planned] >= EARLIER(Data[Planned]) && Data[State] = "Closed")
    )
VAR _result = _startnumber - _minus_count
RETURN
    _result

 

 

SpartaBI_0-1658253646763.png

 




2022-05-19 17_30_22-Re_ Need help on DAX function with measure vs colu... - Microsoft Power BI Commu.png


Full-Logo11.png

SpartaBI_3-1652115470761.png   SpartaBI_1-1652115142093.png   SpartaBI_2-1652115154505.png

Showcase Report – Contoso By SpartaBI

Hello SpartaBI,

thanks a lot for your feedback. It works frine on my end. It looks such a simple code but I would never have been able to write it with my limited skills in DAX language. One question. When I would like to add more than one option than the state 'Closed', e.g. 'Cancelled' and 'Done' how can I add these two additional states to the script?

Thanks

Olaf

SpartaBI
Community Champion
Community Champion

@OlafA69 no worries, you will get there 🙂
Not sure what exactly did you mean, but if you will write the exact requirment whenever you need it (you don't have to now), just open a new question and refer to this one and mention me. 

Please don't forget to accept the previous message as a solution for community visibility.
P.S. Check out my showcase report - got some high level stuff there. Sure you will find there a lot of cool ideas. 
https://community.powerbi.com/t5/Data-Stories-Gallery/SpartaBI-Feat-Contoso-100K/td-p/2449543
Give it a thumbs up over there if you liked it 🙂

Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

 

Untitled.png

 

Actual CC =
VAR _startdate =
    MIN ( Data[Date] )
VAR _startnumber =
    MAX ( Data[Planned] )
VAR _conditiontable =
    ADDCOLUMNS ( Data, "@condition", IF ( Data[State] = "Closed", -1 ) )
VAR _cumulatecondition =
    SUMX (
        FILTER ( _conditiontable, Data[Date] <= EARLIER ( Data[Date] ) ),
        [@condition]
    )
RETURN
    _startnumber + _cumulatecondition

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.