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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
suppportme
New Member

How to show in bar only the current status of an item in powerbi

I am a beginner in powerbi, please help me with enough detail to solve this scenario:

Suppose that I have several records in a table like these:

| Item | Status | Date |Semester |
|------| ------------ |------------|---------|
| C1 | Ready | 12/06/2024 | S1-2024 |
| C2 | In progress | 09/06/2024 | S1-2024 |
| C1 | In progress | 08/06/2024 | S1-2024 |

I need a bar chart that only shows the most recent status of all the items in a current period of time in this case "semester", in the example for S1-2024 the data table must be:

| Item | Status | Date |Semester |
|------| ------------ |------------|---------|
| C1 | Ready | 12/06/2024 | S1-2024 |
| C2 | In progress | 09/06/2024 | S1-2024 |

How can accomplish that?

1 ACCEPTED SOLUTION
suppportme
New Member

Hi guys, finally based on this thread: https://stackoverflow.com/questions/78048985/dax-code-to-calculate-a-new-column-by-latest-date-categ... I have just created a calculated column as follows that marks with 1 to the latest date in semester related to the bd:

IsLatestDate = 
VAR CurrentDate = 'ParchBD'[Date]
VAR CurrentSemester = 'ParchBD'[Semester]
VAR CurrentBDD = 'ParchBD'[BDD]
VAR CurrentStatus = 'ParchBD'[Status]
RETURN
IF(
    CurrentDate = CALCULATE(MAX('ParchBD'[Date]), FILTER(ALL('ParchBD'), 'ParchBD'[Semester] = CurrentSemester &&'ParchBD'[BDD] = CurrentBDD)),
    1,
    0
)

Then I have created a calculated table that shows bdd, semester, status and date filtered by the latest date in the semester:

LatestStatusDate = 
SUMMARIZE(
    FILTER('ParchBD', 'ParchBD'[IsLatestDate] = 1),
    'ParchBD'[BDD],
    'ParchBD'[Semester],
    'ParchBD'[Status],
    'ParchBD'[Date]
)

Finally I dragged the field of the LatestStatusDate table to the visual to show only the latest status of each bd during the semester:

 

graph.png

I hope all the cases are considered, as far as I verified this accomplish the goal.

Any suggestions are welcome.

 

View solution in original post

3 REPLIES 3
suppportme
New Member

Hi guys, finally based on this thread: https://stackoverflow.com/questions/78048985/dax-code-to-calculate-a-new-column-by-latest-date-categ... I have just created a calculated column as follows that marks with 1 to the latest date in semester related to the bd:

IsLatestDate = 
VAR CurrentDate = 'ParchBD'[Date]
VAR CurrentSemester = 'ParchBD'[Semester]
VAR CurrentBDD = 'ParchBD'[BDD]
VAR CurrentStatus = 'ParchBD'[Status]
RETURN
IF(
    CurrentDate = CALCULATE(MAX('ParchBD'[Date]), FILTER(ALL('ParchBD'), 'ParchBD'[Semester] = CurrentSemester &&'ParchBD'[BDD] = CurrentBDD)),
    1,
    0
)

Then I have created a calculated table that shows bdd, semester, status and date filtered by the latest date in the semester:

LatestStatusDate = 
SUMMARIZE(
    FILTER('ParchBD', 'ParchBD'[IsLatestDate] = 1),
    'ParchBD'[BDD],
    'ParchBD'[Semester],
    'ParchBD'[Status],
    'ParchBD'[Date]
)

Finally I dragged the field of the LatestStatusDate table to the visual to show only the latest status of each bd during the semester:

 

graph.png

I hope all the cases are considered, as far as I verified this accomplish the goal.

Any suggestions are welcome.

 

Anonymous
Not applicable

Hi @suppportme ,

Here is my sample data:

vjunyantmsft_0-1720056726934.png

You mentioned that you need to create bar charts, but I'm not sure how you intend to create them with this data, so I'll use the table visual object as an example. The exact steps are the same.
Use this DAX to create a measure:

Measure = 
VAR _MAXDAY = 
CALCULATE(
    MAX('Table'[Date]),
    ALLEXCEPT('Table', 'Table'[Item], 'Table'[Semester])
)
RETURN
IF(
    MAX('Table'[Date]) = _MAXDAY,
    1,
    0
)

Please set the settings according to the following screenshot:

vjunyantmsft_1-1720056946512.png

vjunyantmsft_2-1720056988898.png

And the final output is as below:

vjunyantmsft_3-1720057018972.png

The same steps apply to bar charts.


Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Thank you so much for your help.

It works perfectly but the real situation is that I have to some way count all these values to show in a graph as I show you below, where you can see that exists count of bdd (I called item in my initial post). Currently it counts all the status of all the items in all dates, when I need just count distinct the latest ones in the period of semester.

 

graph.png

 

I do not know how to apply your solution to this case. Apparently I need to filter as the solution that you gave me and then count them distinct. Could you help me please to see how to do that? 

I am really thankful for your help.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Top Solution Authors