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

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

Reply
Anonymous
Not applicable

FORMAT - Switch and IF

Hi All,

 

I need to change my Switch calculation to remove the BLANK()

Var =
IF (
    HASONEVALUE (Swap[Measure]),
    SWITCH (
        VALUES (Swap[Measure]),
        "Sales",FORMAT('Sales'[Number],"#,##"),
        "Qty",FORMAT(SUM('Sales'[Qty]),"€#,##0.##")
        ),
     FORMAT(SUM('Sales'[Qty],"#,##")
)

 

GallopPBI_1-1715942607367.png

The scenario I am working on is similar to the below post :

https://community.fabric.microsoft.com/t5/Desktop/FORMAT-ignores-filter/td-p/1161371

 

Can you please help how to remove the null values but also take care of the formatting?

 

I just need to update the above calculation to remove the NULL values which show up when I use the FORMAT within the calculation. Thanks

13 REPLIES 13
Anonymous
Not applicable

@lbendlin Can you please advise? Thanks

lbendlin
Super User
Super User

Something seems off with your formatting.  Having not seen your sample data here is my guess.
 
Var =
IF (
    HASONEVALUE (Swap[Measure]),
    SWITCH (
        VALUES (Swap[Measure]),
        "Sales",FORMAT('Sales'[Number],"€#,##0.##"),
        FORMAT(SUM('Sales'[Qty]),"#,##")
        ),
     FORMAT(SUM('Sales'[Qty],"#,##")
)
Anonymous
Not applicable

@lbendlin Thanks. The problem is not with formatting but with blanks. Please advise

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Anonymous
Not applicable

@lbendlin Can you please help with above information? I tried creating a sample but it worked fine in it. Also do not see an optio to attach a pbix file in this post

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Anonymous
Not applicable

@lbendlin 

 

Documents

 

Here is a link with sample data and pbix file. As informed, I want to filter on the Date filter and that is not working when I use the format calculation. Thanks

lbendlin_0-1716059973713.png

 

Anonymous
Not applicable

@lbendlin Thank you, this works for one column. But I have 3 columns with different measures. How can I get the same parameter to swap on different fields? So ideally I would like one parameter.

 

Documents

 

Thanks

 

Please refer to updated data here

 

 

 

GallopPBI_0-1716113441014.png

 

But 3 columns in all will have 6 measures to swap and for every column it will be Qty, Sls but different fields. Thanks

You can use field parameters for both columns and measures.  

 

Please provide sample data that fully covers your issue.
Please show the expected outcome based on the sample data you provided.

Anonymous
Not applicable

@lbendlin Thanks. I have uploaded the sample data with the new columns in the link above

 

GallopPBI_0-1716122322966.png

I want the same parameter 

GallopPBI_1-1716122358207.png

 

But I want to have 3 columns as output in the visual

 

Year-MonthParaPara APara BPara C
     
     
     

 

How can I use the parameter to swap values for all the 3 columns? Thanks

looks like the link still has the old file. Please validate.

Anonymous
Not applicable

@lbendlin Thanks. I checked again and it has the new excel file.

GallopPBI_0-1716147503961.png

Please advise.

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!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors
Top Kudoed Authors